Dean Fraj
/
DC_motor_1
Program for controlling speed of motor
Fork of DC_motor_1 by
main.cpp@1:36da0aeaa51f, 2017-12-18 (annotated)
- Committer:
- dfraj
- Date:
- Mon Dec 18 10:52:02 2017 +0000
- Revision:
- 1:36da0aeaa51f
- Parent:
- 0:1047df2357c5
v2: added second PwmOut object
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 | 1:36da0aeaa51f | 3 | PwmOut smjer1(p21); |
dfraj | 1:36da0aeaa51f | 4 | PwmOut smjer2(p22); |
dfraj | 0:1047df2357c5 | 5 | PwmOut ledica(LED1); |
dfraj | 0:1047df2357c5 | 6 | AnalogIn pot(p20); |
dfraj | 0:1047df2357c5 | 7 | |
dfraj | 0:1047df2357c5 | 8 | int main(){ |
dfraj | 1:36da0aeaa51f | 9 | smjer1.period(0.001); |
dfraj | 1:36da0aeaa51f | 10 | smjer2 = 0; |
dfraj | 0:1047df2357c5 | 11 | while(true){ |
dfraj | 1:36da0aeaa51f | 12 | smjer1 = pot; |
dfraj | 0:1047df2357c5 | 13 | ledica = pot; |
dfraj | 0:1047df2357c5 | 14 | } |
dfraj | 0:1047df2357c5 | 15 | } |