Is there something smaller and less expensive that will run this code as is (pin can be changed and I do not need the LED) I will need it to run on 5v and do not need something with a built in regulator as it will be fed from a 5v regulator.
Code: Select all
// This sketch will operate a servo in the auto cat feeder as soon as it boots.
// The Arduino is powered on and off with an external timer and relay
// this was done to save battery power, the Arduino, External 5v regulator, and servo power
// are all provided 12v when the timer goes off and closes the relay. The boot and ontime of the servo
// is approximately 13 seconds, the timer on time is about 15 seconds. A momentary push button can be
// depressed and held to provide voltage for an demand run.
#include <Servo.h> // include the servo lib
Servo my_servo; // define my server object
int ledPin = 13; // LED connected to digital pin 13 can remove before going live
int input_value = 1; // when power up set value
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output so I know it is working with no servo
my_servo.attach(9); //Attach pwm signal wire to pin 9
}
void loop()
{
// soon as powered up run
for (int cnt = 0; cnt < 18; cnt++) {
if (input_value > 0 ) {
digitalWrite(ledPin, input_value);
my_servo.writeMicroseconds(1450);
delay(250);
my_servo.writeMicroseconds(1600);
delay(350);
} // end if
} // end for
input_value = 0; // set var to 0 to stay out of for loop
digitalWrite(ledPin, input_value); // Turn off LED
my_servo.writeMicroseconds(1500); // stop servo
}