Martha MigliacioAlex Wong
Published © GPL3+

Using the Pmod BTN with Arduino Uno

Application notes for Pmod BTN and Arduino Uno. In this app, the state of the pushbutton will be shown in the serial monitor.

EasyProtip1 hour76
Using the Pmod BTN with Arduino Uno

Things used in this project

Hardware components

Pmod BTN
Digilent Pmod BTN
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Pmod BTN and Arduino Uno Fritzing file

Fritzing file displaying the connection of the Pmod BTN to the Arduino Uno.

Pmod BTN and Arduino Uno Fritzing Image

Fritzing image displaying the connection between the Pmod BTN and Arduino Uno.
Pmodbtn arduinouno bb w88k6aslyh

Code

Pmod BTN and Arduino Uno Code

Arduino
Using this code will show the state of the pushbutton in the 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.");
  }
 }
}

Credits

Martha Migliacio

Martha Migliacio

5 projects • 5 followers
Alex Wong

Alex Wong

5 projects • 14 followers
I work in Digilent and like creating projects
Thanks to Lextronics.

Comments

Add projectSign up / Login