Ok, I got a chance to try this and it will not compile clean due to an error stating that "servo is not declared..."
I am using the same servo.h file as before and it is choking on the "servo::refresh();" line...
Here is the error that I received:
In function 'void flap(int, int)':
error: 'servo' has not been declared.
I added a few items to the code but other than that it is pretty much as you sent it.
Also, the servo.h file is stored in the folder c:\aduino-0010\hardware\libraries\servo as it was with my original bad code...
Here is the code:
#include <Servo.h>
#include <Wire.h>
#include <string.h>
#include <stdio.h>
#define Button 12 // action button is connected to d12
#define yada 10 // yadayadayada is connected to d10
Servo servo1;
Servo servo2;
void setup() {
servo1.attach(14); //analog pin 0
servo1.setMaximumPulse(2000);
servo1.setMinimumPulse(700);
servo2.attach(15); //analog pin 1
pinMode(Button, INPUT); // sets the digital pin 12 as input
pinMode(yada, OUTPUT); // sets the digital pin 10 as output
digitalWrite(yada, HIGH); // turns the yadayadayada off
} void flap(int nbrOfTimes, int flapRate){
// routine cycles the servos back and forth
while( nbrOfTimes--){
for(int i=0; i < 180; i+= flapRate){
servo1.write(i);
servo2.write(i);
servo::refresh();
delay(20);
}
for(int i=180; i > 0; i -= flapRate){
servo1.write(i);
servo2.write(i);
servo::refresh();
delay(20);
}
}
}void loop() {
if (digitalRead(Button) == HIGH) {
digitalWrite(yada, LOW); // turns the yadayadayada on
delay(100);
digitalWrite(yada, HIGH); // turns the yadayadayada off
flap(5,15); // flap 5 times at a fast rate
}
}
What am I doing wrong?
thanks!