[vc_row][vc_column][vc_column_text]
Linker button is the key, the SIG(signal output port) of linker button is at a low level(logic0)in case no button
pressed, after the button press, SIG will output a high level (logic 1). And pcduino GPIO through testing
linker button SIG level to determine key state.
In this post, we will demo how to control the linker led through linker button.[/vc_column_text][vc_tour][vc_tab title=”Part list” tab_id=”1394434978-1-72″][vc_column_text]1. [bigcommerce link=”/pcduino-v2-an-minipc-with-arduino-headers-ubuntu-android-google/” target=”_blank”]pcDuino V2[/bigcommerce] x1
2. [bigcommerce link=”/button-module-of-linker-kit-for-pcduino-arduino/” target=”_blank”]Linker Button[/bigcommerce] x1
3. [bigcommerce link=”/5mm-blue-led-module-of-linker-kit-for-pcduino-arduino/” target=”_blank”]Linker LED[/bigcommerce] x1
4. [bigcommerce link=”/base-shield-of-linker-kit-for-pcduino-arduino/” target=”_blank”]Linker Base[/bigcommerce] x1
5. [bigcommerce link=”/20-cm-cable-for-linker-kit/” target=”_blank”]Linker cable[/bigcommerce] x2[/vc_column_text][/vc_tab][vc_tab title=”Wiring Diagram” tab_id=”1394434978-2-47″][vc_column_text][/vc_column_text][/vc_tab][vc_tab title=”Test code” tab_id=”1394493515172-2-5″][vc_column_text]
import gpio from time import sleep led_pin = "gpio2" button_pin = "gpio3" def delay(ms): sleep(1.0*ms/1000) def setup(): gpio.pinMode(led_pin, gpio.OUTPUT) gpio.pinMode(button_pin, gpio.INPUT) print " Linker LED Pin : D2 n Linker Button Pin : D3" def loop(): while(1): if(gpio.digitalRead(button_pin)): gpio.digitalWrite(led_pin, gpio.HIGH) else : gpio.digitalWrite(led_pin, gpio.LOW) setup() loop()
[/vc_column_text][/vc_tab][vc_tab title=”Test result” tab_id=”1394493516267-3-1″][vc_column_text]
[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.