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?
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.
Could you post a schematic 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 SPI pins on the Arduino Mega are on different pins50 (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).
The schematics are exactly 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
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).