Let's Make Robots!

2 tests and 2 failures - what am I doing wrong?

Hi All,

Firstly - I am fairly new to the Arduino but have experience in C.

I have successfully combined the Arduino Mega with LED's, Thermistors, LDR's ECT and started to look at some bigger things. I first looked at working with servo's, I used a cheap servo that I had lying around that originally came out of a RC toy car (HPI Minizilla).  I wired everything up and used the 'sweep' example from the Arduino website to try it out but it wouldn't work - the servo did power up but didn't move.  I attached an LED to pin 13 and programmed a 'blink' at the end of every loop to check it was cycling and it was, but I found no reason as to why the servo didn't move.

My second task was to use a Sparkfun LIS3LV02DQ Triple Axis Accelerometer ( http://www.coolcomponents.co.uk/catalog/product_info.php?cPath=36&products_id=135 ) with my Mega so I used the suggested method found here: http://www.nearfuturelaboratory.com/2006/09/22/arduino-and-the-lis3lv02dq-triple-axis-accelerometer/

I soldered and wired up everything perfectly but again - nothing. So this time I used the Serial.println at various stages in the code to detect what was happening.  I found that everything works until the Arduino starts to talk to the sensor - at this point the code stops running altogether???

My question is this - have I done something wrong as the examples are written for Duemilanove and not the Mega?  If so - what do I need to change?

Or - Am I doing something completley wrong?

Please put me out my misery!

Thanks in advance,

James

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Check it out - http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1244060600/19#19

 Need to use the MegaServo library instead!

The SPI pins on the Arduino Mega are on different pins 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). You cannot expect that every Arduino example you found on the Internet works for the Arduino Mega without any modification.

All examples included in the Arduino environment should work without any modification (including the servo sweep example).  For the rest you have to check what special hardware has been used (I2C, SPI).

Should have read all of the posts before I started replying!

It does look like a pin issue - is it just a case of chaning the pin setup at the start of the code to the matching new pins for the mega?

Yes, changing the pins in the code and wiring should help.

I agree with the guy from the Arduino forum about the servo issue. Servos from cheap RC toys may have different control mechanism. I have an Arduino mega and a lot of servos, so I can make a test  this evening (Europe time).

That would be a great help - thanks in advance!
Could you post a schematic of how you connected everything or maybe a photo of your setup? Also, posting your sourcecode might help. It's a bit difficult to say, if you are doing something wrong, when we can't see what you are doing.
The schematics are exactly as the examples on the Arduino site for the 'sweep' and the Arduino example link on the coolcomponents site.  I think its a pin variation on the mega problem not user error :-)

Maybe a silly question, but have you gone into the Tools menu, to Board, to switch to Arduino Mega?

Alternately, there may be differences in the pin functions of the Mega compared to the Duemilanove/Deicimilia, but I figure the developers would have worked that out before releasing it.

It also may be a weird servo that takes different signals than standard. 

Regarding the accel, get something like the servo working before trying to debug a SPI problem. 

Yes I have selected the Mega in the board options.

Your second point may have hit the nail on the head - I posted the same topic on the Ardunio forum and got a similar responce regarding pin variations - see here : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1244060600/0 

How do I find out what the variations are for future so I can solve myself?

Good point on getting the servo to work first but again - it looks like a pin issue!  I'll let you know!

i cant really help you, as i dont have an arduino, and never used an accelorometer, but i read they are pretty much plug and play. :D