video PWM with Arduino - step by step guide
Small step by step guide on how to use the PWM (Pulse Width Modulation) of the Arduino board. The video includes the components needed and an easy to follow connection guide, as well as a demo of the results obtained. The code is also included. Try it out yourself, enjoy! :D
saarp182 years ago
What about doing it with Synapse modules rf engines?
Have you heard about them?
Veda882 years ago
What kind of motor are you using?
jgrecoarroyo (author)  Veda882 years ago
The motor used in the example is just a cheap regular DC motor. The kind of you can find in "science kits" for kids.
pratyadi2 years ago
A modified Sketch that actually works with HS 422 servo, Gertboard and Raspberry Pi:

You do not need servo.h library
rclear2 years ago
Very nice elaboration.
Will you specify what transistor you were using?
The code is a bit difficult to read in the video, could you please post it on your instructable?
jgrecoarroyo (author)  alien2000496553 years ago
Here is a link to the code: https://docs.google.com/document/d/1sVM4R4C8etX_34tTUtQkLbK3lBE_LEjYgY0WJMRuDi0/edit?pli=1

And here the code itself:

int motor = 9;
int potenciometer = 5;

void setup(){

void loop(){
  int value = analogRead(potenciometer);
                     //read input value: range between (0,1023)
  int motor_speed = value/4;
                    //PWM can only ouput 255 different values
  Serial.println(motor_speed);//for testing purposes
agreco53 years ago
Useful and straight to the point - keep them coming!
jgrecoarroyo (author)  agreco53 years ago
Thanks, they will be more comming for sure :)