I am trying to get some code to work on my new Due but I am hitting a wall. I think this is likely straightforward and so I thought I would see if someone can explain it to me.
I have this running nicely on my Uno.http://www.instructables.com/id/Arduino-Tutorial-ADNS-9800-Laser-Mouse-Traveled-Di/
It basically allows me to access the distance traveled from an optical mouse chip. Obviously it works through the SPI protocol. The nice thing about the tutorial is that it also has a Fritzing layout of the hardware wiring diagram (I am ignoring the display and just using the serial monitor for now). I think transferring it from the Uno to the Due is given me trouble both in tweaking the code and where to send the chip info to.
Here's what I had on the Uno.
Slave Select to Pin 10
Mosi to Pin 11
SK (clock) to pin 13
Miso to pin 12
Motion (MOT) to pin 2
Voltage in (5V) to +5V pin
Analog Ground to GND
Digital Ground to GND
On the Due I am making most of the connections to SPI header Just to the left of the Atmel chip. I found this confusing as the Due documentation said to place them on the header with ICSP written below it. http://arduino.cc/en/Reference/SPI
Nevertheless, I put them on SPI. When viewed such that the word SPI is normally oriented, I placed the wires on the following pins.
Upper left Pin = MISO
Upper Right Pin = Voltage In (VI)
Middle Left pin = SC
Middle Right pin = MOSI
Lower Right Pin = DG (Digital Ground)
I then placed the analog ground to a random ground on the board.
I placed the motion pin from the chip to pin 2 on the Due because that's where it was on the Uno. Does this seem right?
I placed the SS of slave select on pin 10 because that's where it was on the Uno.
Given that I tried to keep things similar between the two boards, should this work to run the same code. The behavior that I get now is that it automatically increase the x and y displacement infinitely. So it does not appear to be behaving as it did on the UNO.
The code is un-altered from the link above. I tried to insert it here but it exceed the character limit. I can post it separately if that helps.
Thank you so much for any help as it is obviously much appreciated!