This application note was designed to show the state of the Pmod BTN push buttons in the Arduino Uno serial monitor.
Thanks to Lextronics.
Application notes for Pmod BTN and Arduino Uno. In this app, the state of the pushbutton will be shown in the serial monitor.
Hardware components | ||||||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
Software apps and online services | ||||||
![]() |
|
This application note was designed to show the state of the Pmod BTN push buttons in the Arduino Uno serial monitor.
*************************************************************************
* Description: Pmod_BTN
* The state of the push button will be show in the serial monitor.
*
* Material
* 1. Arduino Uno
* 2. Module Pmod BTN
*
************************************************************************/
boolean bp;
int index=0;
void setup()
{
Serial.begin(9600); // initialization of the serial monitor
for (int i=2; i<=5; i++) // configuration pins 2 to 5 in input
{
pinMode(i,INPUT);
}
}
void loop()
{
for(int i=2; i<=5; i++) // read state of push buttons
{
bp=digitalRead(i);
delay(40); // Debounce
if(bp==HIGH)
{
Serial.print("Le bouton BTN");
index=i-2; // index calculation push buton
Serial.print(index);
Serial.println(" est actif.");
}
}
}
Comments