![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
lololololol
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
main.cpp@2:d9b0ebf3fcca, 2019-09-10 (annotated)
- Committer:
- Hendrikvg
- Date:
- Tue Sep 10 15:03:50 2019 +0000
- Revision:
- 2:d9b0ebf3fcca
- Parent:
- 1:b862262a9d14
- Child:
- 3:68d78770639b
Rood knippert, blauw en groen kunnen aan gezet worden
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RobertoO | 0:67c50348f842 | 1 | #include "mbed.h" |
RobertoO | 1:b862262a9d14 | 2 | #include "MODSERIAL.h" |
RobertoO | 0:67c50348f842 | 3 | |
RobertoO | 1:b862262a9d14 | 4 | MODSERIAL pc(USBTX, USBRX); |
Hendrikvg | 2:d9b0ebf3fcca | 5 | DigitalOut led(LED_RED); |
Hendrikvg | 2:d9b0ebf3fcca | 6 | Ticker ReadEnCoder; |
Hendrikvg | 2:d9b0ebf3fcca | 7 | |
Hendrikvg | 2:d9b0ebf3fcca | 8 | volatile char color='r'; |
Hendrikvg | 2:d9b0ebf3fcca | 9 | |
Hendrikvg | 2:d9b0ebf3fcca | 10 | void knipper() |
Hendrikvg | 2:d9b0ebf3fcca | 11 | { |
Hendrikvg | 2:d9b0ebf3fcca | 12 | led = !led; |
Hendrikvg | 2:d9b0ebf3fcca | 13 | } |
RobertoO | 0:67c50348f842 | 14 | |
RobertoO | 0:67c50348f842 | 15 | int main() |
RobertoO | 0:67c50348f842 | 16 | { |
RobertoO | 0:67c50348f842 | 17 | pc.baud(115200); |
Hendrikvg | 2:d9b0ebf3fcca | 18 | ReadEnCoder.attach(knipper,0.05); |
Hendrikvg | 2:d9b0ebf3fcca | 19 | while (true) |
Hendrikvg | 2:d9b0ebf3fcca | 20 | { |
Hendrikvg | 2:d9b0ebf3fcca | 21 | color = pc.getc(); |
Hendrikvg | 2:d9b0ebf3fcca | 22 | if (color == 'r'){ |
Hendrikvg | 2:d9b0ebf3fcca | 23 | DigitalOut led(LED_RED); |
Hendrikvg | 2:d9b0ebf3fcca | 24 | } |
Hendrikvg | 2:d9b0ebf3fcca | 25 | if (color == 'g'){ |
Hendrikvg | 2:d9b0ebf3fcca | 26 | DigitalOut led(LED_GREEN); |
Hendrikvg | 2:d9b0ebf3fcca | 27 | } |
Hendrikvg | 2:d9b0ebf3fcca | 28 | if (color == 'b'){ |
Hendrikvg | 2:d9b0ebf3fcca | 29 | DigitalOut led(LED_BLUE); |
Hendrikvg | 2:d9b0ebf3fcca | 30 | } |
RobertoO | 0:67c50348f842 | 31 | } |
Hendrikvg | 2:d9b0ebf3fcca | 32 | } |