Processing with Intel Galileo

Page 1


1. LED and Resistor Hello. What can we do to implement our innovative ideas in the physical world out of computer? Galileo can help us, but Galileo is just a platform. It’s like a brain or bone in our body. Of course we need eyes, nose, ears, hands, or feet. In other words, we need ‘shield’ or ‘breadboard.’

Here, we will use ‘breadboard’ first to do a simple experiment. The easiest way is to use the same sketch that we just used before. Breadboard has lots of holes that you can stick wires or electronic components into it. Turn off the Galileo’s power first, and then bring ‘breadboard’ next to Galileo. For this simple experiment, two electronic devices are required; we will use a LED and a resistor which are in ‘Galileo Starter Kit.’ A component that must be connected in a certain orientation in relation to the flow of electrical current is considered to be polarized.

I will use a ‘red LED’ and a ‘100 ohm resistor.’ Resistor has no polarity, but LED has a positive pole called anode and a negative pole call cathode, so you should distinguish them well. The long leg is the anode and the short one is the cathode. 2


2. Structure of ‘Breadboard’

‘Tester’ can help to understand the structure of ‘breadboard.’ Set up the ‘tester’ so that it can make sound, and then let the end of the two lines to be in contact. It means that the electricity is flowing if the sound is made. Check by connecting ‘tester’ on various pins on the ‘breadboard.’ ‘Jumper wires’ are good aids. Sometimes it sounds, and sometimes it doesn’t. Now, insert the LED’s cathode into the same row of the breadboard that’s connected to ground pin of Galileo using a jumper wire. Insert a resistor on the breadboard so that one side of it can connect to the LED’s anode.

Using another jumper wire, connect Galileo’s digital pin #13 to the other side of the resistor that is not directly connected to LED. Now, our first circuit is completed. The energy from the flow of electrons in the circuit can be used by the LED, which is converting that electrical current into light energy. 3


3. Blinking LED on ‘Breadboard’ Now, reconnect the Galileo’s power. Is USB connected properly? Do not forget to check ‘Serial port’ as well.

If there is no ‘Sketch’ named ‘Blink’ in IDE, reopen it. Lastly, click the ‘upload’ button. What result did you get?

4


For sure, the third green LED on the Galileo board will flicker. Do you see the red LED on the ‘breadboard’ blinking as well? Then, your experiment is successful. ‘pinMode()’ configures the specified pin to behave either as an input or an output. If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value of 5V (or 3.3V on 3.3V boards) for HIGH and 0V (ground) for LOW. ‘digitalWrite()’ writes a HIGH or a LOW value to a digital pin. Close the ‘Blink’ sketch by clicking ‘X’ on upper right corner of IDE for the next experiment.

5


4. Fade LED Using PWM

We are now going to conduct an experiment to repeat slow turning on and off of the LED on the ‘breadboard.’ Go to File>Example>01.Basics>Fade. New Sketch window will be created. There was ‘digitalWrite()’ function in the ‘blink’ source code, but ‘analogWrite()’ is used for the ‘fade’. It utilized a principle called ‘Pulse Width Modulation (PWM).’

You will see the number 9 in the source code. So, move the ‘jumper wire,’ which is connected to Galileo’s digital pin #13, to pin #9. If you look the board closely, you will notice that there is ‘~’ sign at pin #9. Digital pins 3, 5, 6, 9, 10 and 11 can use with analogWrite(). In order to fade your LED off and on, gradually increase your PWM value from 0 (totally off) to 255 (totally on), and then back to 0 once again to complete the cycle. Click the ‘upload’ button in the new window. See, LED on the ‘breadboard’ is now dimming up and down unlike the result of the ‘blink.’ 6


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.