Hi everyone,
Im Matt from the UK and have just taken delivery of an LM scout.
Ive built it all up with HS422 servos, an SCC-32 and the brain is an Ardiuno Mega.
I have the servis ‘under my control’ as it were, and have got it setting to a nice rested position as well as standing tall, now its on to walking…
I have had a loo at the source of the other chaps (the one with vids) which is in basic Atom. Can anyone lend a hand translating it to C for the Ardiuno?
I know a bit iof basic and C (degree in comp sci a few years ago…) but didnt want to start if it simply wasnt going to work.
Translating the movement subroutine so far I have:
Original Atom basic:
Movement [SeqIndex]
For Index = SeqPos(SeqIndex) to SeqPos(SeqIndex + 1) - 1
TmpServo = Steps(Index) >> 11
TmpValue = Steps(Index) & 2047
if LastServo = TmpServo then
TmpValue = TmpValue << 5
if DejaVu then
Pause TmpValue
LastServo = 99
else
serout p15,i115200,“T”, DEC TmpValue, 13]
DejaVu = DejaVu ^ 1
endif
else
TmpValue = TmpValue + 500
serout p15,i115200,"#", DEC TmpServo, “P”, DEC TmpValue]
DejaVu = 0
LastServo = TmpServo
endif
next
return
Now my C code:
void movement(int SeqIndex){
int TmpServo=0;
int TmpValue=0;
int LastServo=0;
int Dejavu=0;
// For Index = SeqPos(SeqIndex) to SeqPos(SeqIndex + 1) - 1
for(int Index=SeqPos[SeqIndex];Index<SeqPos(SeqIndex+1);Index++){
TmpServo=Steps[Index] >> 11;
TmpValue=Steps[Index] & 2047;
if(LastServo==TmpServo){
TmpValue = TmpValue << 5;
if(Dejavu){
delay(TmpValue);
LastServo=99;
else
Serial1.print
I thought Id stop there before I go to far down the wrong route, especially if someone has a ‘gait list’ of frame positions, or can someone extract the gait list from the sequence at the start of the bas file. 9For reference, the bas file I am working from is the one provided here:
Any help much appreciated!
Cheers, Matt