Hi i’m making a robotic hand for my school project and im having a lot of problems with programming.
2 Arduino Unos with 2 Xbee shields and 2 series 1 Xbees
one setup reads the values of flex sensors and the other turns the servo motors
the servos im using are: towardpro MG946R
I think i have the sending Arduino working properly but im not quite sure about the receiving Arduino.
when i test one flex sensor for 1 servo the servo wont move to the specified position, instead it just humms and flickers
right now im running the servo from a 6v battery supply (4 AA batteries)
here is the code for the sending Arduino:
int finger = A0;
int val = map(analogRead(finger), 390, 700, 0, 9);
and the code for the recieving:
int servoPin =10;
while(Serial.available() == 0);
int data = Serial.read() - ‘0’;
int pos = map(data, 0, 9, 0, 180);
pos = constrain(pos, 0, 180);
this is just to test 1 finger and to get it to move to 9 different positions.
i would really appreciate any help