Martha MigliacioAlex Wong
Published © GPL3+

Using the Pmod CDC1 with Arduino Uno

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

BeginnerProtip1 hour287
Using the Pmod CDC1 with Arduino Uno

Things used in this project

Story

Read more

Schematics

Pmod CDC1 and Arduino Uno Fritzing file

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

Pmod CDC1 and Arduino Uno Fritzing Image

Fritzing image displaying the connection between the Pmod CDC1 and Arduino Uno.

Code

Pmod CDC1 and Arduino Uno Code

Arduino
Using this code will show the state of the button in the serial monitor.
/************************************************************************
*
* Test of the Pmod module
*
*************************************************************************
* Description: Pmod_CDC1
* The state of the button will be show in the serial monitor.
*
* Material
* 1. Arduino Uno
* 2. Module Pmod CDC1
*
************************************************************************/

// Assignement of pins
#define BTN_1 2
#define BTN_2 3

void setup()
{
 Serial.begin(9600); // initialization of the serial monitor
 pinMode(BTN_1,INPUT); // configuration of the pin 2 in input
 pinMode(BTN_2,INPUT); // configuration of the pin 3 in input
}

void loop()
{
 if(digitalRead(BTN_1)==true) // If button 1 active
 {
  Serial.println("Bouton 1 actif"); // write in serial monitor
 }
 if(digitalRead(BTN_2)==true) // If button 2 active
 {
  Serial.println("Bouton 2 actif"); // write in serial monitor
 }
 delay(100);
}

Credits

Martha Migliacio

Martha Migliacio

5 projects • 13 followers
Alex Wong

Alex Wong

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

Comments