This tutorial shows the simplest thing you can do with Odinub to see the physical output using LED blinking.
This LED is connected to a GPIO and its number may vary from board type to board type. To make your life easy, we have a constant that is specified in every board descriptor file.
Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the GND. In the diagram below we show Odinub that has GPIO23.
The LED will lit up also with values up to 1K ohm. So you can vary the value of Resistors.
Odinub GPIO Break Down:
After building the circuit now let's jump on the code and lets' boot Odinub. You can connect Odinub with Screen using HDMI and Key Board Mouse. Also, you can use Odinub with your Laptop.
The first thing you can do after booting is to Open Terminal on Odinub.
This will create a python script in your home folder and you can write your code here. So now you can import GPIO library which will be pre-installed in your device. import nubio
Let's walk through the function which you need to blink LED.
This function means that you selected GPIO 23 and set them as output mode.
This supplies 3.3 volts to the LED anode. That creates a voltage difference across the pins of the LED and lights it up. Then you turn it off with the given function:
That takes the 23 GPIO back to 0 volts and turns the LED off.
After firing this command you will able to see LED Blinking in Realtime.If in between the on and the off, you want enough time for a person to see the change, so the time.sleep commands tell the board to do nothing for 1000 milliseconds, or one second.
Below you can find out full code to control LED.