SO , I'm working on this kinetic sculpture and to drive the clockwork based on the lighting i'm using arduino. I'm using a photo resistor and reading the ambient light value off of analog pin A0 and using a geared motor that is sold as a continuous rotation servo ( 0=anticlockwise rot, 90=stop, 180=clockwise rot). When I run the motor through inputs via processing (by uploading firmata on a mega board), things run smoothly. But when I try to upload the code onto the board itself so I can run it independent of my laptop, the motor doesn't seem to respond. I opened the serial monitor and the resistance values seem to be coming in smoothly. Here is my code, can anyone figure out why this might be happening?
It should be straight forward and simple but I can't see what's going wrong, i checked the wiring, power supply, everything I could think of.
#include <Servo.h>
Servo servo;
void setup()
{
Serial.begin (9600);
servo.attach(8);
}
void loop()
{
float pres = analogRead(A0);
Serial.println(pres);
if (pres < 140)
{ servo.write(90);
}
else if (pres > 140 && pres < 300)
{ servo.write(180);
}
else if (pres > 300)
{ servo.write(0);
}
delay(2000);
}