Project 1 - Controlling a DC motor using PWM and monitoring its Running status
Project 1 - Controlling a DC motor using PWM and monitoring its Running status
AIM: to control a DC motor using PWM modulation an dto moniter its running status by writing a aurdino code.
code :-
void setup()
{
pinMode(3, OUTPUT); // sets the pin3 as output
pinMode(0, INPUT);// sets the pin0 as output
pinMode(1, INPUT);// sets the pin1 as output
}
void loop()
{
analogWrite(3, i); // analogWrite values from 0 to 255
if (digitalRead(0)==LOW)
{
if (i<255)
{
i++;//if pin0 is pressed and the duty ratio value is less than 255
delay(30);
}
}
if (digitalRead(1)==LOW)
{
if (i>0)
{
i--;// if pin1 is pressed and the duty ratio value is greater than 0
delay(30);
}
}
}
COMPONENTS USED:
- IC
- LCD
- BJT
- RELAY
- DC MOTOR
- RESISTOR (100 OMH)

