I've received the Leo, G15 shield and G15 servo today, along with the 12V 2Amp wall power supply.
I've connected everything and and I get some level of success - i've programmed the address successfully (I choose 8) using the SetID example, I then moved onto the positioning example - again this uploads correctly to the board and the red light flashes as I think it should I amended the code such that I have the following
- CODE: SELECT_ALL_CODE
#include <G15.h> // include the library
#define LED_BOARD 13
/*Return Error definitions & Mask
=====Higher 8 bits of Word=========
packet length error : 0x0100
packet header error: 0x0200
ID mismatch error: 0x0400
packet checksum mismatch : 0x0800
====Lower 8 bits of word==========
Error status return by G15:
INST 0x0040
OVERLOAD 0x0020
CHECKSUM 0x0010
RANGE 0x0008
OVERHEAT 0x0004
ANGLELIMIT 0x0002
VOLTAGE 0x0001
*/
//declaration of variables & object
word ERROR=0;
byte DATA[10];
word STATUS;
//declare G15 Class Object
//servo1 ID=1
G15 servo1(0x08); //Set the right motor ID
//servo2 ID=2
//G15 servo2(2);
void setup(){
//initialize the arduino main board's serial/UART and Control Pins
G15ShieldInit(19200,3,8);
//call the init function to init servo obj
servo1.init();
//servo2.init();
//init LED indicator as output
pinMode(LED_BOARD,OUTPUT);
digitalWrite(LED_BOARD, LOW);
delay(500);
digitalWrite(LED_BOARD, HIGH);
}
void loop(){
servo1.SetLED(ON,iWRITE_DATA);
servo1.SetSpeed(500,iWRITE_DATA);
servo1.SetPos(ConvertAngle2Pos(0),iWRITE_DATA); //goto 0 degree pos
delay(5000); //keep the light on for 5 seconds to test
servo1.SetPos(ConvertAngle2Pos(90),iWRITE_DATA); //goto 90 degree pos
servo1.SetSpeed(250,iWRITE_DATA);
servo1.SetLED(OFF,iWRITE_DATA);
//delay(1000);
//servo2.SetLED(ON,iWRITE_DATA);
//servo2.SetSpeed(250,iWRITE_DATA);
//servo2.SetPos(ConvertAngle2Pos(0),iWRITE_DATA); //goto 0 degree pos
//delay(1000);
//servo2.SetSpeed(500,iWRITE_DATA);
//servo2.SetPos(ConvertAngle2Pos(90),iWRITE_DATA); //goto 90 degree pos
//servo2.SetLED(OFF,iWRITE_DATA);
delay(1000);
}
So now I talk to servo at 8, and the red servo LED stays on for 5 seconds and off for 1, so I'm assuming the communications part is all successful.
My issue is the motor never moves, so I think I have a motor power problem. I have the 12v line plugged in directly to Leo board and both LED's illuminate on the shield, and Leo is powered.
If I plug my USB lead in, with no power supply I get the same effect, both boards are powered, and there seems to be no power jumpers on the Leo board.
I haven't tried powering the shield using the JP1 connector directly yet as looking in the manual I need to change JP3 over from INT to EXT and I dont have a soldering iron handy until tomorrow.
Is there something obvious either with Leo board or the shield I am missing?
Thanks for any help!!
---------------------------------------------------------------------------------------------------
Whilst typing this up and testing things I've reached the conclusion there is something wrong with the example code included for download, as if I replace the 'loop' code with the following from the tutorial the servo does what it is supposed to, so no power problems
- CODE: SELECT_ALL_CODE
servo1.SetPos(0,iWRITE_DATA);
delay(800);
servo1.SetPos(1087,iWRITE_DATA);
delay(1600);
servo1.SetPos(544,iWRITE_DATA);
delay(800);
I'll decipher the error in the included example tomorrow, for now I'm content with what I've done so far.