Step 3Libraries
this step will tell you how to use libraries.
1. download from http://code.google.com/p/ds2arduino/
2. extract it
3. you can see ARDUINO and NDSL directories.
For NDSL
-test homebrew
complie it. If you press UP key, it will send Data.
Receive data will automatically triggered by ARDUINO.
- make your own program
copy include directory and source directory to your project's main directory.
(in other words, make include directory, copy header file. then copy cpp file to your source directory.)
include ds2arduino.h file
initialize with ndslArduino.initialize();
send data with ndslArduino.sendData(DATA WHAT YOU WANT TO SEND);
get data with ndslArduino.getData();
sendData can transmit 32bit once.
getData will return uint32 value.
For ARDUINO
-test program
copy ARDUINO\libraries\ds2arduino to your library directory.
open ds2arduino.pde
uncomments commands what you want.
Let's test it!
- make your own program
include ds2arduino.h file
initialize with ndslArduino.initialize(OUTPUT PIN, INPUT PIN MUST 2 or 3);
(output pin can be anyone among digital pins. input pin must be one of 2 or 3.)
send data with ndslArduino.sendData(DATA WHAT YOU WANT TO SEND);
get data with ndslArduino.getData();
sendData can transmit 32bit once.
getData will return uint32_t value.
CAUTION
-NDSL library use timer1 interrupt.
-ARDUINO library use timer1 interrupt, External interrupt.
-If you repeat sending data too rapidly, it can be corrupt.
- DO NOT link VCC and GND directly!!!!!!! YOUR NDSL'S FUSE WILL BE BLOWN!!
(first time, it's okay. But second time, your NDSL will not power up anymore.)
MY youtube videos.
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.
Arduino source code is here.
NDLS source code is attached in library archive.
Code:
#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);
}
}
| « Previous Step | Download PDFView All Steps | Next Step » |






























-test homebrew
complie it. If you press UP key, it will send Data.
Receive data will automatically triggered by ARDUINO.
- make your own program
copy include directory and source directory to your project's main directory.
(in other words, make include directory, copy header file. then copy cpp file to your source directory.)
include ds2arduino.h file
initialize with ndslArduino.initialize();
send data with ndslArduino.sendData(DATA WHAT YOU WANT TO SEND);
get data with ndslArduino.getData();
sendData can transmit 32bit once.
getData will return uint32 value."