Connect ARDUINO with NDSL

http://www.instructables.com/id/Connect-NDSL-with-ARDUINO/
this is my instructable see to more information.

What you can do with it :
transmit data between arduino and ndsl.
so, you can use your nintendo ds to arduino's wireless lan or arduino to your ndsl's digital IO port!

What you need:
Hardware :
NDSL GBA cart cover
nintendo Y driver (eventhough you don`t have, no problem!)
some wires (3 wires, enough! 4 wires GREAT)
cutter knife,
soldering iron,
solder,
ARDUINO
NDSL

Software:
devkitpro
libnds (for nintendo development)
arduino

How it works:
NDSL has GBA bus. It has /WR pin and External interrupt pin.
If you access gba bus, /WR will toggled, so I can use /WR to send data.
However, it lasts just 350us. It mean you cannot use this pin to digital I/O pin directly.
So I mimic NEC REMOTE CONTROLLER protocol(TV, VIDEO etc...)
External interrupt pin is used to receive data, /WR pin is used to send data.
ARDUINO works exactly same way.

these are my youtube video.

this is 3rd movies source code for arduino.
ndsl's code is attached in library archive.

NDSL sends counter data starts from 0.
Everytime clicking + PAD, counter is incresed.
If data is even number, LED is off.
If data is odd number, LED is on.   


#include <ds2arduino.h>
uint32_t temp = 0;
void setup()
{
  ndslArduino.initialize(5, 2);
  pinMode(13, OUTPUT);
}

void loop()
{
  temp = ndslArduino.getData();
  if(temp & 1) {
    digitalWrite(13, HIGH);
  } else {
    digitalWrite(13, LOW);
  }
}

this is my source code(library + example).
[u]Google Code Archive - Long-term storage for Google Code Project Hosting.

I tested it only with my NDSL and ARDUINO, so it could have some errors.
If you have any question or find problem, send me mail
hounjini at gmail.com

Thank you for reading.