This is documentation of my work and questions throughout the semester
CREATE PIO FILE & INPUT CODE FROM LAB
Lab Question: “Try to guess what the results will be before you upload?”
Answer: I am not too sure of the range but I can assume that when the joystick is stationary it will be in the middle of the range and depending on direction the number will shift closer towards x or y accordingly.
Stationary: (513,511)
Up: (513,0)
Down: (513,1023)
Left:(0,513)
Right: (1023,513)
When Joystick is pushed: nothing, numbers just chake from slight movement
Range: 0-1023 since Arduino has a 10-bit Analog-to-Digital Converter (ADC)
Thoughts: While I didnt quite know what to expect, I was very interested to see the relationship between x and y depending on the direction the joystick is pushed. I can visualize it the axises of the numbers correlating to the physical joystick much more clearly. Left and up being the lowest at 0 and right and down having hte highest value of 1023.
Lab Question: if the x and y values arent identicalwhen joystick is at rest, can you guess why?
Answer/Guess:since 1023 is not evently divisible by 2 and Arduino does not like decimals, also the sensor is not perfect and im sure under and over compensates doing the best it can, is anything truly balances and equal?*
Pullup Resistor INPUT_PULLUP
Code Used: pinMode (switchPin, INPUT_PULLUP);
Without Pullup Resistor:
With Pullup Resistor:
Note: Microcontroller chip includes internal pullup to avoid this common enough issue
ADD SWITCH/PUSHBUTTON TO LIST OF VALUES DISPLAYED
CHANGE PROGRAM SO MESSAGE IS SENT WHEN THERE IS CHANGE IN VALUE
(Rather than a nonstop stream)
Two Ways:
New code should send message only when button state changes
Lab Question: Do you get multiple messages even though you push the button once? Why do you think that is?
Answer: Two messages per button push, one for the push and another for the release, both are changes in the sensor
ISSUE I am stuck on how exaclty I would change to code to only send mesage when state goes from HIGH to LOW, what exacly does ! mean again
SEND MESSAFE THE MOMENT ANALOGUE INPUT PASSES CERTAIN THRESHOLD
Can be useful w light or temperature sensor, we will try with joystick x-axis
Observations: Holding the joy stick in the direction does not cause continuous flow of messages, when moving it rapidly it must be moves back towards middle, below value of 800 (chosen threshold) slight changes are not enough, I an=m sure a larger threshold would allow