[vc_row][vc_column][vc_column_text]Linker 1×2 button matrix has two 6*6*5cm buttons, and will be more convenient in Arduino related projects.[/vc_column_text][vc_tour][vc_tab title=”Parts List” tab_id=”1395239110-1-74″][vc_column_text]
- 1 x Linker 1×2 button matrix
- 1 x [bigcommerce link=”/cityduino-arduino-uno-compatible-device/” target=”_blank”]Arduino Uno [/bigcommerce]
- 1 x [bigcommerce link=”/20-cm-cable-for-linker-kit/” target=”_blank”]20cm cable for linker kit[/bigcommerce]
- 1 x Liker base shield for Arduino
[/vc_column_text][/vc_tab][vc_tab title=”Wiring Diagram” tab_id=”1395239110-2-62″][vc_column_text]Connect the Linker 1×2 button matrix to the base shield [D2 D3] using a linker cable.
The base shield is installed on a Arduino Uno.
Connect Arduino Uno to PC through a USB cable.
[/vc_column_text][/vc_tab][vc_tab title=”Test Code” tab_id=”1395239204847-2-9″][vc_column_text]
/************************************************************************* > File Name: Linker_1x2_button_matrix.c > Author: Darren > Created Time: Fri Jan 1 00:05:19 2010 ************************************************************************/ #include "Arduino.h" const int s1_pin = 3; const int s2_pin = 2; void setup(){ pinMode (s1_pin, INPUT); pinMode (s2_pin, INPUT); Serial.begin (9600); } void loop (){ if(digitalRead (s1_pin)){ Serial.println ("buttom_1 have been hold down!"); } delay (50); if(digitalRead (s2_pin)){ Serial.println ("buttom_2 have been hold down!"); } delay (50); }
[/vc_column_text][/vc_tab][vc_tab title=”Test Result” tab_id=”1395239206046-3-4″][vc_column_text]Press the left button, the screen will print “button_2 has been hold down!”
Press the right button, the screen will print”button_1 has been hold down!”
Leave a Reply
You must be logged in to post a comment.