Mechatronics LAB
Published © Apache-2.0

Arduino Workshop-Simple Motor Control

Arduino Workshop-Simple Motor Control This tutorial we are going to Arduino Simple Motor Control, in one

BeginnerFull instructions provided1 hour2,820
Arduino Workshop-Simple Motor Control

Things used in this project

Story

Read more

Schematics

Arduino Workshop-Simple Motor Control

Code

Code snippet #1

Arduino
int potPin = 0; // Analog in 0 connected to the
potentiometer
int transistorPin = 9; // PWM Pin 9 connected to the base of
the transistor
int potValue = 0; // value returned from the potentiometer
void setup() {
// set the transistor pin as output:
pinMode(transistorPin, OUTPUT);
}
void loop() {
// read the potentiometer, convert it to 0 - 255:
potValue = analogRead(potPin) / 4;
// use that to control the transistor:
analogWrite(transistorPin, potValue);
}

Credits

Mechatronics LAB
75 projects • 49 followers
I am Sarful , I am a Mechatronics Engineer & also a teacher I am Interested in the evolution of technology in the automation industry .

Comments