Hi, i'm new to arduino and i'm trying to control the DC motor of a Furby, so i can send it commands to sleep / act surprised. I've read that the motor controls the eyes, the mouth and the ears all at once so moving every part individually is not going to work. Right now all i can do is make everything move in a constant loop. I can make it stop too but then it starts off from where it stopped before….
http://f.cl.ly/items/2e3G0P0H140x2N3a200X/IMG_0126.MOV
I did this by using the following code:
int motorPin = 9;
void setup() {
pinMode(motorPin, OUTPUT);
Serial.print("setup");
Serial.begin(9600);
}
void loop() {
for(int i= 0; i < 255; i++) {
analogWrite(motorPin, i);
Serial.print(i);
delay(5);
}
}
At first i thought that the value written to the pin with analogWrite() controlled the movement, so that when i would change it from 100 to 130 it would correspond to a movement that for example looks like the Furby is going to sleep(instead of changing the speed).
Is there a way to say at what moment in the loop of movements it should start or stop?
Thanx for helping!