3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Connect NDSL with ARDUINO

Step 3Libraries

for send & receive data, you need both NDSL library and ARDUINO library.

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 StepDownload PDFView All StepsNext Step »
1 comment
Mar 3, 2012. 12:41 PMArthur Reichert says:
please, can you explain me how I use the ndsl library? I didn't understand this: "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."


Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
1
Followers
1
Author:Hounjini