Arduino Central
Design with the Arduino. Learn to program in C and C++ without getting overwhelmed
Wednesday, June 7, 2017
PWM Motor Drive
CODE FOR PWM DRIVE
int motor = 9;
int speed = 0;
void setup() {
pinMode(motor, OUTPUT);
}
void loop() {
analogWrite(motor, speed);
speed = speed + 31;
if (speed > 250)
{
speed = 255;
}
delay(4000);
if (speed > 250)
{
speed = 0;
}
}
No comments:
Post a Comment
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment