-->

Using the FUZE IO Board

So far our breadboard hasn’t been connected to the FUZE or Raspberry Pi in any way, but all that’s about to change. We’re now going to remove the battery and slot our breadboard into the FUZE.

GPIO PINS


The Raspberry Pi’s GPIO pins act as a physical interface between the Raspberry Pi and electronic items. On the FUZE these are safely connected to the IO board, and can then be connected to your breadboard.

Step 1

Remove the 9V battery and battery clip if it is still connected to the breadboard, and slide the breadboard into the top of the FUZE so the wires and LED are near the IO board. Let’s take a closer look at what the IO board has to offer.

Using the FUZE IO Board
Using the FUZE IO Board


Step 2

If you look closely at the IO board you’ll see a section of pins marked “RPI Header”. These match the pins that are on your Raspberry Pi. On the right side of the board are a number of output sockets. The PWM and supply sockets provide steady power (3.3V or 5.0V as marked).


Step 3

The pins marked “GPIO” and numbered 1-7 are more interesting. These can be turned on or off from inside programs, or at the command line. When turned on they provide 3.3V, and when off they provide nothing. These On/Off switches can be used to activate and deactivate components you attach to the Raspberry Pi.



Step 4

Start by connecting a blue cable to the pin marked GND in the Supply section on the top right of the FUZE IO board. Connect the other end to the leftmost hole in the blue rail, now running along the top of the breadboard. Connect a red cable to the socket marked 3.3V on the supply section in the bottom right of the IO board. Connect the other end of the cable to first hole in the red rail running along the bottom of the breadboard. The LED will come on.


Step 5

This isn’t any different to what we had before, so let’s spice things up. Remove the red cable from the 3.3V IO socket and connect it to the socket marked 0 underneath GPIO. The LED will turn off. This is because this socket won’t provide any power until we tell it to.



Step 6

Start FUZE BASIC and enter:

  1. PinMode (0, 1)
  2. DigitalWrite (0, 1)

The LED turns on. The first part, PinMode, tells the Raspberry Pi that GPIO 0 is going to be used, and the 1 part says it will be output. The DigitalWrite command sets GPIO 0 on. Enter DigitalWrite (0, 0) to turn the LED off.



GETTING INPUT

We’re now really steaming along. Our Raspberry Pi-powered FUZE is turning on LED lights in the outside world. Next we need to look at input; how we can get information from our breadboard to our Raspberry Pi.

Step 1

Remove the LED and resistor from the breadboard and remove the GPIO 0 and GND cables. Place the Push button switch in the same place as the LED (B1 and D2) and place the blue cable in the hole next to it (E2). Take a look at the photo if you need help placing the items in the right holes.


Step 2

Now take the blue cable in E2 and connect the other end to GPIO 0. Finally, connect the red cable
from the first hole in the power rail to 3.3V. Our circuit is complete. Current will go from the 3.3V to the power rail, and from the power rail to our switch. The switch is connected to our blue cable, which connects to GPIO.



Step 3

Press F2 to open the Program Editor. Enter the following program:

  1. PinMode (0, 0)
  2. Until DigitalRead(0) Cycle
  3. Repeat
  4. Print “Button Pushed”

Press F3 to run the program.



Step 4

Here’s what happens. Power is flowing from the 3.3V socket to the switch where it stops. Meanwhile our program has set GPIO 0 to 0 (input mode) and a Cycle Repeat loop is waiting until input comes through on 0 (via DigitalRead). When we push the button a connection is made, power flows to GPIO 0 and it alerts the program. It then prints the message “Button Pushed”.



0 Response to "Using the FUZE IO Board"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel