Martha MigliacioAlex Wong
Published © GPL3+

Using the Pmod HB3 with Arduino Uno

Application notes for Pmod HB3 and Arduino Uno. In this app, a motor will be controlled and the status displayed on the serial monitor.

EasyProtip1 hour286
Using the Pmod HB3 with Arduino Uno

Things used in this project

Hardware components

Pmod HB3
Digilent Pmod HB3
×1
Pmod SWT
Digilent Pmod SWT
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Digilent DC Motor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Pmod HB3 and Arduino Uno Fritzing file

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

Pmod HB3 and Arduino Uno Fritzing Image

Fritzing image displaying the connection between the Pmod HB3 and Arduino Uno.
Pmodhb3arduino uno bb fvc6n1vjp0

Code

Pmod HB3 and Arduino Uno Code

Arduino
Using this code will set up the Pmod SWT and Pmod HB3 to control a motor and then display the status on the serial monitor.
/************************************************************************
*
* Test of Pmod HB3
*
*************************************************************************
* Description: Pmod_HB3
* Switch SW1 controls the stop or rotation of the motor.
* Switch SW2 controls the direction of rotation of the motor.
* The status of the motor is displayed on the serial monitor.
*
* Material
* 1. Arduino Uno
* 2. Pmod HB3 
* 3. Pmod SWT 
*
************************************************************************/
// Affectation of pins
#define DIRECTION 2
#define VALIDATION 3
#define SWT_1 4
#define SWT_2 5

boolean inter_1;
boolean inter_2;

void setup()
{
 Serial.begin(9600); // Initialization of the serial monitor
 pinMode(DIRECTION,OUTPUT); // Pin configuration
 pinMode VALIDATION,OUTPUT);
 pinMode(SWT_1,INPUT);
 pinMode(SWT_2,INPUT);
}

void loop()
{
 inter_1=digitalRead(SWT_1); // Reading switch SW1
 inter_2=digitalRead(SWT_2); // Reading switch SW2
 if (inter_1==HIGH) // stop motor
  {
   digitalWrite(DIRECTION,LOW);
   digitalWrite(VALIDATION,LOW);
   Serial.println("Le moteur est arrete"); // display in serial monitor
  }
 else // The motor is running
  {
   if (inter_2==HIGH)
   {
    digitalWrite(DIRECTION,HIGH);
    digitalWrite(VALIDATION,HIGH);
    Serial.println("Le moteur tourne dans le sens horaire");
   }
   else
   {
    digitalWrite(DIRECTION,LOW);
    digitalWrite(VALIDATION,HIGH);
    Serial.println("Le moteur tourne dans le sens anti-horaire");
   }
  }
}

Credits

Martha Migliacio

Martha Migliacio

5 projects • 5 followers
Alex Wong

Alex Wong

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

Comments

Add projectSign up / Login