int main () { if (wiringPiSetup () == -1) { fprintf (stdout, "oops: %s\n", strerror (errno)) ; return 1 ; } softServoSetup (0, 1, 2, 3, 4, 5, 6, 7) ; softServoWrite (0, 0) ; /* softServoWrite (1, 1000) ; softServoWrite (2, 1100) ; softServoWrite (3, 1200) ; softServoWrite (4, 1300) ; softServoWrite (5, 1400) ; softServoWrite (6, 1500) ; softServoWrite (7, 2200) ; */ while(1) { for (int i=0; i<2200; i++) { softServoWrite (0, i) ; delay (100) ; } for (int i=2200; i<0; i--) { softServoWrite (0, i) ; delay (100) ; } } }
int main(void) { if (wiringPiSetupGpio() == -1) return 1 ; softServoSetup(RCSERVO2,-1,-1,-1,-1,-1,-1,-1); softServoWrite(RCSERVO1, -250); delay(2000); softServoWrite(RCSERVO1, 500); delay(2000); softServoWrite(RCSERVO1, 1250); delay(2000); }
int main () { if (wiringPiSetup () == -1) { fprintf (stdout, "oops: %s\n", strerror (errno)); return 1 ; } softServoSetup (0, 1, 2, 3, 4, 5, 6, 7) ; softServoWrite (0, 500); int range = 500; int vel = 10; for (;;) { softServoWrite (0, range); range += vel; if (range > 1250 || range < -250) vel = -vel; delay (10); } }