06 April 2022

Project 2: progress report

Joseph Hart
Physical Computing
Project 2 Report
4/6/2022

Controller

My controller is a spherical capsule that can be rotated utilizing the accelerometer in order to provide motion controls. My game requires only movement as its core input, making this controller excellent for its needs. Since the game is physics based and the character model is a sphere, the controller provides an accurate relation between player input and character output. I have taken advantage of the LED lights on the Arduino to give visual feedback of which direction the board is being tilted; however, the board has 10 lights, but the game will only take 8 directions (when using keyboard), therefore the lights are controlled by a Neonum variable, but the actual controller has be relegated to 8 directions that were stretched to the 10 lights. This means that 1 direction may be associated with multiple lights. In a way this is a good thing.


Above is an example of the Neonum & Movdir directional variables. Below is the final sketch of the controller; ultimately I abandoned the battery being used as a balance because I moved over to using the fragile lithium battery.



And below this is the schematic for the controller. I decided to simply take the actual schematic portions from the Arduino and magnify them over my more basic use of the device:




Here is the YouTube video link of my 2 minute video:


PSUEDO CODE:

Libraries:
Adafruit_CircuitPlayground
Bluefruit and Math

Variables:
BLEDis and BLEHidAdafruit
debounce, neonum and a move direction

Setup:
Initilize libraries
Set bled model and manufacturer
Begin advertising for bluetooth
Start everything
Serial will be 115200, not 9600

Advertise function:
Flags, appearance, other details in the email

Tilt values function:
x and y axis for motion
atan2(x,y)
Use mapfloat function to:
set neonum to a range of 0-10
and move direction to a range 0-8
Clear pixels and light up neonum

Mapfloat function:
Teacher made this function, works good, just copy paste

Loop:
Get tilt values;
Check if connected via bluetooth and then use tilt values in order to:
switch (movedir)
run through all 8 cases and press ASWD keys accordingly
make sure to release() the keys as well


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.