I have a couple laying around (most people I know do for some reason).
Using the easiest interface I know I'll stick with the Teensy.
First lets just get the motor going:
Here's a basic circuit that powers the motor with 5 volts but triggers the motor with a transistor.
It's a very easy circuit, I stole it ada fruits tutorial to do the same thing with a full arduino.
Their example code allows you to specify the motor speed between 0 and 255 but I only have 2 hands so I'm going to turn it on and off.
int motorPin = 20;
void setup()
{
pinMode(motorPin, OUTPUT);
}
void loop()
{
analogWrite(motorPin, 255); //Motor turn on
delay(1000);
analogWrite(motorPin, 0); //Motor turn off
delay(1000);
}
No comments:
Post a Comment