Hi,
I am trying to control servo with pololu maestro and serial communication from linux. When I try to set target which lower 7 bits is 0x0A the servo moves to Maestro lower limit (which I set in windows). It does not make difference what the higher 7 bits are, only lower 7bits = 0x0A cause this behavior.
This behavior is completely weird because it works OK on my laptop with the same OS (OpenSuse 11.2). When I tried to upgrade the firmaware to v1.01 my maestro died (not recognized as USB device anymore) - but I had two of them so my pain can continue. And Pololu do not return any error. Also when setting the value from Control Center in Windows it is OK. I can probably fix it by avoiding such values but that is insane …
This is small piece of code that cause that described above, the 0x31 value can be replaced for anything else - it will still goes to the limit on my desktop.
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <termios.h>
int main()
{
int fd = open("/dev/ttyACM0", O_RDWR | O_NOCTTY);
char message[] = {0x84,0x00,0x0A,0x31};
//char message[] = {0x84,0x00,0xB,0x31};
//char message[] = {0x84,0x00,0xb,0x31};
unsigned char buf[2];
struct termios options;
tcgetattr(fd, &options);
options.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
tcsetattr(fd, TCSANOW, &options);
write(fd,message,4);
exit(0);
}
If anyone have some idea of what could be the problem, that would be highly appreciated.
Thanks