Dean Fraj
/
DC_motor_1
Program for controlling speed of motor
Fork of DC_motor_1 by
main.cpp@0:1047df2357c5, 2017-12-18 (annotated)
- 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?
User | Revision | Line number | New 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 | } |