Arduin Basics Intr t ArduBlcks Materials: Arduin ArduBlcks Sftware Arduin IDE Laptp Breadbard Wires Resistrs LEDs Ptentimeter Temprary Push Buttn
Get the Sftware Dwnlad Arduin IDE https://www.arduin.cc/en/main/sftware Dwnlad ArduBlcks t Arduin IDE http://surcefrge.net/prjects/ardublck/?surce=typ_redirect Hw t Cnnect ArduBlcks t Arduin IDE 1.Dwnlad ardublck-all.jar ArduBlck 2. In Arduin IDE, pen menu Arduin -> Preferences 3. Find Sketchbk lcatin: In Mac, it s by default Dcuments/Arduin under user s hme directry In Linux, it s by default sketchbk under user s hme directry In Windws, it s by default Dcuments\Arduin under user s hme directry 4. Cpy ardublck-all.jar t tls/ardublcktl/tl/ardublck-all.jar under Sketchbk lcatin,assume the user is abu, In Mac, /Users/abu/Dcuments/Arduin/tls/ArduBlckTl/tl/ardublck-all.jar In Linux, /hme/abu/sketchbk/tls/ardublcktl/tl/ardublck-all.jar In Windws, C:\Users\abu\Dcuments\Arduin\tls\ArduBlckTl\tl\ardublckall.jar * Be careful, the name f flder ArduBlckTl under tls flder is case sensitive.
5. Start the Arduin IDE and find ArduBlck under the Tl menu Materials Arduin UNO Breadbard
Circuits Resistrs Here s an example f a 4.7kΩ resistr with fur clr bands:
Ptentimeters ArduBlcks All blcks within a lp d functin, and nly ne lp per cde. Digital functins have runded edges, and Analg functins have pints (backwards chevrns). Duble click n a blck t drag it. Drag blcks ver Categries and release t remve frm screen. When blcks are clse, click n ne t make Sure Blcks snap tgether. Categries Explained Prject 1 Turn n an LED What d we want: What we want t d is t tell the Arduin that a specific pin n ur right-side rw f the Arduin bard is an utput. We want that utput t be fully pen. It des nt matter if this pin is Digital (ON r OFF, TRUE r FALSE, 1 r 0) r Analg (smth reslutin f 5 vlts, spread between integers 0 and 255). Bth will allw us t turn the LED n as an utput.
Steps: 1. Start ut with lp functin, fund in the tp cntrl categry. 2. Set Digital Pin, which writes a binary value (HIGH r LOW, 1 r 0) t a pin #(9). OR 3. Set Analg Pin, which writes a value (255, r 100% ON) t a pin # (9). Prject 2 Blink LED Hw d we make an LED turn n and ff fr a given time? We need a way t Turn the LED n, pause fr a mment f time, turn the LED ff, pause fr anther mment in time, and then repeat the cycle. Since we are putting this cde in a lp functin, the repeating part is dne fr us by the Arduin.
Steps: 1. Rebuild the cde blck frm Prject 1 2. Search fr a time delay blck. This is fund within the Generic Hardware categry. (*1000 millisecnds = 1 secnd). 3. We want t turn the light ff. Right click n yur first Set Analg/Set Digital pin. 4. Play arund with delay times! The way the cde is written, the light will blink n and ff fr as lng as we keep it pwered.
Prject 3 LED Dimmer with Ptentimeter We want t turn n an LED with a pin frm the Arduin. Then, we want t read the resistance n the ptentimeter with an analg input pin (bttm left side f Arduin). Frm here, we want t define the LED s brightness as the value f the ptentimeter. Steps: 1. Start ff with ur d lp. 2. Add the AnalgWrite functin. Define a pin # as an utput, and write a value t the utput. 3. The utput is autmatically an interger. Let s delete the interger and add ur wn value. This will be the value f the ptentimeter. 4. We want t read the ptentimeter. Fill in AnalgRead blck as the assigned value.. Did it wrk?. The Arduin has an input analgread reslutin f 0-1023, and an analgwrite reslutin f nly 0-255. The ptentimeter has a reslutin that s 4 times greater than what can be defined in the LED, s the LED runs thrugh fur cycles
f a dimmer. If we culd nly smehw change the reslutin f the ptentimeter frm 0 1023 t 0-255 5. Lk dwn at the bttm lp, and ntice the map blck. This des just what we need; change the pt reslutin dwn t 0 255, s that it matches the LED utput. Yu ll find that map blck in the bttm f the categry Math Operatrs. Prject 4 Mre with the ptentimeter Dimming might nt be fr everyne. What if we want t cntrl ur very wn light shw? What we are ging t d is use the ptentimeter t cntrl hw fast the light turns n and ff. This invlves setting up a blinking light, just as we accmplished earlier. Instead f the light blinking fr 1 secnd, let s set it t blink at the rate f ur ptentimeter! This will use a similar circuit as the last prject. Steps: 1. Start with lp. 2. Define and Write analg (r digital) utput pin t an ON value. 3. Add a delay f time 4. Redefine the pin utput t be OFF.
5. Remve time integers in delay blcks (1000). 6. Replace with ur Map functin f the ptentimeter s Analg input value.