Hi, i had help on my arduino code before, thanks for that.
I thought i had i sorted but i didn’t.
I’ll post the relevant parts.
I decided to try out the newsoftserial library as you suggested:
When i set target as 8000, it goes to the extreme end – i was told it would take values from 4000 - 8000.
But any 4000 and 2000 just give the same position - Centre.
Just really desperate to get this solved.
#include <NewSoftSerial.h>
#define txPin 4
#define rxPin 3
NewSoftSerial mySerial(rxPin, txPin);
void setup()// run once, when the sketch starts
{
mySerial.begin(9600);
delay(1000);
}
void putf(unsigned char servo, unsigned int target)
{
target = 2000; // The value i'm using for testing and will changed by another function later
unsigned int temp;
byte pos_hi,pos_low;
temp = target & 0x1f80;
pos_hi = temp >> 7;
pos_low = target & 0x7f;
//Send a Pololu Protocol command
mySerial.print(0xAA,BYTE); //start byte
mySerial.print(0x0C,BYTE); //device id
mySerial.print(0x04,BYTE); //command number
mySerial.print(servo,BYTE); //servo number
//Convert the angle data into two 7-bit bytes
mySerial.print(pos_low, BYTE);
mySerial.print(pos_hi,BYTE);
}
What am i doing wrong?
Thanks in advance.