Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- #define MAX_FINGER 5
- // #include
- // create servo object to control a servo
- typedef struct {
- Servo myservo;
- byte servoAng;
- } SERVO;
- SERVO servo[MAX_FINGER];
- void setup() {
- Serial.begin(9600);
- int i = 0;
- for (i = 0; i < MAX_FINGER; i++) {
- servo[i].myservo.attach(i + 2);
- }
- }
- void loop() {
- if(Serial.available() >=5) {
- int i = 0;
- for (i = 0; i < MAX_FINGER; i++) {
- servo[i].servoAng = Serial.read();
- servo[i].myservo.write( servo[i].servoAng );
- }
- // Send the servo to the position read... (note: you get to make this happen)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement