Hi guy,
I’m very falling in crazy…I don’t know the problem…
In little world, I have my Arduino Yun version communicate with micro maestro which handle my two servo motors in the pan&tilt webcam.
Ok…follow the core sketch code:
YunClient client = server.accept();
if (client) {
x = 0;
y=0;
x = client.parseInt(); //Leggi il primo valore
client.read(); //Leggi /
y = client.parseInt(); //Leggi il secondo valore
maestro_set_target(0, y);
maestro_set_target(1, x);
client.stop();
}
where maestro_set_target is
void maestro_set_target(byte servoChannel, int angle){
//set the target for a servo
//servo is the servo number (typically 0-5)
//angle is the target, from 256 to 13120, in quarter-microseconds
angle = (map(angle, 0, 180, MIN_SERVO_MILLIS, MAX_SERVO_MILLIS)*4); //Mappa il valore di "target" tra 500 e 2500
maestro_send_command(0x84, servoChannel, angle, 0);
}
and maestro_send_command is
void maestro_send_command(byte cmd, byte servoChannel, int target, byte device){
// id del device non utilizzato al momento
// sends a command with 3 byte of data
MAESTRO_START_TRANSMISSION();
serialBytes[0] = cmd; // Il primo byte contiene il Set Target --> move servo
serialBytes[1] = servoChannel; // Primo byte: indica su quale canale è in ascolto il servo
serialBytes[2] = target & 0x7F; // Secondo byte: selezione i 7 bit meno significativi di target (0-6)(LSB)
serialBytes[3] = (target >> 7) & 0x7F; // Terzo byte: prelevo i 7 bit pi√π significativi di target (7-13)(MSB)
MaestroSerial.write(serialBytes, sizeof(serialBytes)); //Scrivo l'array di byte su Maestro
MAESTRO_END_TRANSMISSION();
}
When I send command to servo from web trough java script canvas,
One of two servo (always the same) after same minute of use, fall in permanent block and does not move anyway…
It seems that the servo falling in block when I send it around 180 degree… but not always…
HELPPPPPPP MEEEE pLEASEEEEE