Pinguino + 2 Amp Motor Driver Shield

Pinguino+ Arduino 2 Amp Motor Driver Shield

Motor Shield Diagram:

Pin:

Pin Allocation:

Control Signal Truth Table:

For more information, please refer HERE

Example 1: Rotate dc motor in clockwise and counter-clockwise direction

Flow Chart:

Program Code:

int E1 = 5;
int M1 = 7;
int E2 = 6;
int M2 = 4;

void setup() 
{ 
    pinMode(M1, OUTPUT);
    pinMode(M2, OUTPUT); 
    pinMode(E1, OUTPUT);
    pinMode(E2, OUTPUT); 
} 

void loop() 
{ 
    digitalWrite(M1,HIGH); //clockwise
    digitalWrite(M2, HIGH);
    digitalWrite(E1, HIGH); 
    digitalWrite(E2, HIGH); 
    delay(5000); 
    digitalWrite(E1, LOW); //stop
    digitalWrite(E2, LOW);
    delay(2000);
    digitalWrite(M1,LOW); //counter-clockwise
    digitalWrite(M2, LOW);
    digitalWrite(E1, HIGH); 
    digitalWrite(E2, HIGH); 
    delay(5000);
    digitalWrite(E1, LOW); //stop
    digitalWrite(E2, LOW);
    delay(2000); 
}

Demonstration:

Example 2: Control motor speed with pwm

Flow Chart:

Program Code:

#define sw1 8
#define sw2 9
#define sw3 10
#define led1 29
#define led2 28
#define led3 27
int E1 = 12;
int M1 = 7;
int E2 = 13;
int M2 = 4;

void setup() 
{ 
    pinMode(M1, OUTPUT);
    pinMode(M2, OUTPUT); 
    pinMode(E1, OUTPUT);
    pinMode(E2, OUTPUT);
    pinMode(sw1, INPUT);
    pinMode(sw2, INPUT);
    pinMode(sw3, INPUT);
    pinMode(led1, OUTPUT);
    pinMode(led2, OUTPUT);
    pinMode(led3, OUTPUT); 
}

unsigned int value;

void loop() 
{
	digitalWrite(E1,LOW);
	digitalWrite(E2, LOW);

while(1)
{
	digitalWrite(led1,LOW);
	digitalWrite(led2,LOW);
	digitalWrite(led3,LOW);
	if (digitalRead(sw1) == 0)
	{
	    digitalWrite(led1,HIGH);
	    value=512;
	    digitalWrite(M1,HIGH);
	    digitalWrite(M2, HIGH);
	    analogWrite(E1, value); //PWM Speed Control
	    analogWrite(E2, value); //PWM Speed Control
	    delay(30);
	}

	else if (digitalRead(sw2) == 0)
	{
	    if (value<1023)
	   {
	       digitalWrite(led2,HIGH);
	       value+=1;
	       digitalWrite(M1,HIGH);
	       digitalWrite(M2, HIGH);
	       analogWrite(E1, value); //PWM Speed Control
	       analogWrite(E2, value); //PWM Speed Control
	       delay(30);
	    }
	}

	else if (digitalRead(sw3) == 0)
	{
	    if (value>0)
	    {
	       digitalWrite(led3,HIGH);
	       value-=1;
	       digitalWrite(M1,HIGH);
	       digitalWrite(M2, HIGH);
	       analogWrite(E1, value); //PWM Speed Control
	       analogWrite(E2, value); //PWM Speed Control
	       delay(30);
	     }
	}
    }
}

Demonstration:

BUY

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Display on MAX7219 Dot Matrix Using Maker NANO
Heart Rate Monitor Using Pulse Sensor and Maker Nano
Gas Detector Using The MQ2 Sensor on Maker NANO
Control NeoPixel RGB LED Color Code Using Keypad and Maker Nano
Audio Doorbell Using M5GO IoT Starter Kit
Scroll to Top