Motor speed controlled by potmeter
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
main.cpp@5:78a5043b6658, 2019-09-19 (annotated)
- Committer:
- s1932896
- Date:
- Thu Sep 19 14:51:53 2019 +0000
- Revision:
- 5:78a5043b6658
- Parent:
- 1:b862262a9d14
- Child:
- 6:211eab80755c
- Child:
- 9:c9cff697f4ab
led dimmer dmv pot meter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RobertoO | 0:67c50348f842 | 1 | #include "mbed.h" |
RobertoO | 0:67c50348f842 | 2 | //#include "HIDScope.h" |
RobertoO | 0:67c50348f842 | 3 | //#include "QEI.h" |
RobertoO | 1:b862262a9d14 | 4 | #include "MODSERIAL.h" |
RobertoO | 0:67c50348f842 | 5 | //#include "BiQuad.h" |
s1932896 | 5:78a5043b6658 | 6 | #include "FastPWM.h" |
RobertoO | 0:67c50348f842 | 7 | |
s1932896 | 5:78a5043b6658 | 8 | PwmOut led(D3); |
s1932896 | 5:78a5043b6658 | 9 | AnalogIn pot1(A1); |
s1932896 | 5:78a5043b6658 | 10 | AnalogIn but1(A2); |
s1932896 | 5:78a5043b6658 | 11 | AnalogIn but2(A3); |
s1932896 | 5:78a5043b6658 | 12 | |
RobertoO | 0:67c50348f842 | 13 | |
RobertoO | 1:b862262a9d14 | 14 | MODSERIAL pc(USBTX, USBRX); |
RobertoO | 0:67c50348f842 | 15 | |
RobertoO | 0:67c50348f842 | 16 | int main() |
RobertoO | 0:67c50348f842 | 17 | { |
RobertoO | 0:67c50348f842 | 18 | pc.baud(115200); |
RobertoO | 1:b862262a9d14 | 19 | pc.printf("\r\nStarting...\r\n\r\n"); |
RobertoO | 0:67c50348f842 | 20 | |
s1932896 | 5:78a5043b6658 | 21 | |
RobertoO | 0:67c50348f842 | 22 | while (true) { |
RobertoO | 0:67c50348f842 | 23 | |
RobertoO | 0:67c50348f842 | 24 | |
s1932896 | 5:78a5043b6658 | 25 | pc.printf("%f",pot1.read()); |
s1932896 | 5:78a5043b6658 | 26 | led.write(pot1.read()); |
s1932896 | 5:78a5043b6658 | 27 | |
s1932896 | 5:78a5043b6658 | 28 | wait_ms(100); |
RobertoO | 0:67c50348f842 | 29 | } |
RobertoO | 0:67c50348f842 | 30 | } |