0% found this document useful (0 votes)
61 views3 pages

Experiment No. 14: DC-Motor Control Connection:: Microprocessor

This document describes an experiment to control DC motors using a microprocessor. It defines pin connections for two motor enable pins and four motor pins. The code sets the pin modes, then in a loop it uses analogWrite() to control motor speeds and digitalWrite() to switch the motors on and off in different combinations, pausing for delays between cycles to rotate the motors in alternating directions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views3 pages

Experiment No. 14: DC-Motor Control Connection:: Microprocessor

This document describes an experiment to control DC motors using a microprocessor. It defines pin connections for two motor enable pins and four motor pins. The code sets the pin modes, then in a loop it uses analogWrite() to control motor speeds and digitalWrite() to switch the motors on and off in different combinations, pausing for delays between cycles to rotate the motors in alternating directions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

MICROPROCESSOR

EXPERIMENT NO. 14 : DC-Motor Control


Connection:

Coding:
int enmotor1=10;
int enmotor2=11;
int motor1=8;
int motor2=9;
int motor3=12;
int motor4=13;
void setup() {
pinMode(enmotor1, OUTPUT);
pinMode(enmotor2, OUTPUT);
pinMode(motor1, OUTPUT);
pinMode(motor2, OUTPUT);
pinMode(motor3, OUTPUT);
pinMode(motor4, OUTPUT);
}
void loop() {
analogWrite(enmotor1, 153);
analogWrite(enmotor2, 255);
MICROPROCESSOR

digitalWrite(motor1, HIGH);
digitalWrite(motor2, LOW);
digitalWrite(motor3, HIGH);
digitalWrite(motor4, LOW);
delay(9000);
digitalWrite(enmotor1, LOW);
digitalWrite(enmotor2, LOW);
delay(200);
analogWrite(enmotor1, 255);
analogWrite(enmotor2, 153);
digitalWrite(motor1, LOW);
digitalWrite(motor2, HIGH);
digitalWrite(motor3, LOW);
digitalWrite(motor4, HIGH);
delay(9000);
MICROPROCESSOR

You might also like