Step 3: Microcontroller
The simplest way would be to just check whether the tilt signal is high (over 2.5V) or low. But I want to have some sense of speed, it makes the range of the joystick count for something. This i accomplish in the code so that there are 2 speeds and the faster speeds go with the joystick pushed all the way over.
I'm going to use ADC pins on the microcontroller to sense how far I push the joystick in either direction. See connections diagram for that sort of thing. If the ADC is anywhere besides near half, the motor will turn the appropriate way, and faster the farther from half.
Since I'm using steppers, I could count steps and not put a mechanical stopper, but I don't trust that as much. add that to the code if you like.
So you need to load up the C program in AVR studio, build it, and then flash it to the microcontroller. FYI, your motor/ transistors will have to be disconnected from ground unless you program in a seperate circuit. I actually included the aps file so it should be super easy to load up.
Motor.aps2 KB
Remove these ads by
Signing Up






















Not Nice













Visit Our Store »
Go Pro Today »



