For this week we were asked to run an input device off of one of our homemade arduinos. I struggled at first with making the arduino work (coding wise) so I ended up testing a tilt sensor off of an arduino I already had.
The reason I opted for the tilt sensor was because I might use this for my final project. The only downside is the possible movement of my arm triggering the sensor accidentally.
This is the board I made to control servos and take inputs from the tilt sensor or switches. I have yet to get it to connect to my computer, and it doesn't want to make fuse. I asked a TA and they couldn't figure out exactly what was wrong-- It should be discoverable by my compiter but it's just not.
I wired up the tilt sensor with a servo motor and has it move in different directions depending on the input from the tilt sensor. From examingin the sensor closely it seems to work like a switch so it only gives back 0's and 1's instead of variable numbers depeding on how it is tilted.
This is the code I used to control the motor with the sensor. It was relatively straight-forward to write. It didn't seem to download/run on the arduino I made so I tested it on an arduino I already had.
This is the wiring setup for the arduino, tilt sensor, and the servo.
I rewrote the code to better control the servo based on the sensor's input. It works a lot more smoothly with this code than my first one.
I have yet to get the servo board to work even after struggling with it some more so I tried Neil's board and continues to have similar problems. perhaps my laptop doesn't like my boards? Maybe it's a firewall thing? It seems to talk to the computer in lab sometimes.... but I can't figure out why. Maybe I shorted it?