Introduction: Make a Connected Dice With TimeSquAir

Use an NFC tag to launch a dice

Step 1: Get Pictures of a Dice:

Step 2: Go on Node-RED:

First create a new work-space, then add the node «Go» to begin. Add a function a write the following code on the first image.


A litle explanation of the code, you have two variables «max» and «min», the soustraction of the max and the min correspond to your interval. Then «Math.floor» will cast the number into an Integer, «Math.random» a number between 0 or 1 randomly, so it'll do something like this:

Math.random()= 0,849488…

0,849488 * (7-1) = 5,096928

5,096928 + 1 = 6,096928

Math.floor(6,096928) = 6

After that add the node «switch», then make correspond the number you gets randomly to the picture of the dice.

Step 3: Import Images on the TimeSquair:

You'll need a File Transfer Protocol (FTP) like FileZilla who's using here. Open FileZilla and fulfill the parameters (Host, id, password and port). On the right panel you arrived on the root repository of the raspberry pi. Reach back into the repository by clicking on the “double dots”.

Then go in media.

On the left panel go in the repository where your images are. Then right click on the image and click on “send”.

Step 4: Return on Node-Red:

Add the node «picturepicker» click on advanced and add the past of your image: «/media/dice1.png». Repeat this proceed for all the dice.

Finally add the node «speed», «led blank» and «led text», the speed need to be on 0 if you wants your image static. Led blank clear the screen of the TimeSquAir and led text display the image.

Step 5: Launch the Dice With an NFC Tag:

Put your tag on the TimeSquAir, then come back on Node-RED. A tag is appear on the top-left, link it to the fist function, then activate the workspace.

Comments

About This Instructable

371views

2favorites

License:

More by ArthurD27:Connect a light to the weather forecastMake a connected dice with TimeSquAirHack a wireless keyboard into a remote sound box, thanks to TimeSquAir !
Add instructable to: