Program for controlling speed of motor

Dependencies:   mbed

Fork of DC_motor_1 by Dean Fraj

Committer:
dfraj
Date:
Mon Dec 18 10:32:36 2017 +0000
Revision:
0:1047df2357c5
Child:
1:36da0aeaa51f
Program to control speed of motor.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dfraj 0:1047df2357c5 1 #include "mbed.h"
dfraj 0:1047df2357c5 2
dfraj 0:1047df2357c5 3 PwmOut motor(p21);
dfraj 0:1047df2357c5 4 PwmOut ledica(LED1);
dfraj 0:1047df2357c5 5 AnalogIn pot(p20);
dfraj 0:1047df2357c5 6
dfraj 0:1047df2357c5 7 int main(){
dfraj 0:1047df2357c5 8 motor.period(0.001);
dfraj 0:1047df2357c5 9 while(true){
dfraj 0:1047df2357c5 10 motor = pot;
dfraj 0:1047df2357c5 11 ledica = pot;
dfraj 0:1047df2357c5 12 }
dfraj 0:1047df2357c5 13 }