Mouse code for the MacroRat
main.cpp@0:a03c771ab78e, 2017-04-25 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Tue Apr 25 23:30:40 2017 +0000
- Revision:
- 0:a03c771ab78e
- Child:
- 1:8a4b2f573923
init MacroRat
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 0:a03c771ab78e | 1 | #include "mbed.h" |
sahilmgandhi | 0:a03c771ab78e | 2 | #include <stdlib.h> |
sahilmgandhi | 0:a03c771ab78e | 3 | |
sahilmgandhi | 0:a03c771ab78e | 4 | |
sahilmgandhi | 0:a03c771ab78e | 5 | DigitalOut redLed(PC_0); |
sahilmgandhi | 0:a03c771ab78e | 6 | DigitalOut blueLed(PC_1); |
sahilmgandhi | 0:a03c771ab78e | 7 | DigitalOut greenLed(PC_2); |
sahilmgandhi | 0:a03c771ab78e | 8 | |
sahilmgandhi | 0:a03c771ab78e | 9 | DigitalOut IR_1(PB_0); |
sahilmgandhi | 0:a03c771ab78e | 10 | DigitalOut IR_2(PB_1); |
sahilmgandhi | 0:a03c771ab78e | 11 | DigitalOut IR_3(PB_13); |
sahilmgandhi | 0:a03c771ab78e | 12 | DigitalOut IR_4(PB_14); |
sahilmgandhi | 0:a03c771ab78e | 13 | |
sahilmgandhi | 0:a03c771ab78e | 14 | Serial serial(SERIAL_TX, SERIAL_RX); |
sahilmgandhi | 0:a03c771ab78e | 15 | |
sahilmgandhi | 0:a03c771ab78e | 16 | int main() |
sahilmgandhi | 0:a03c771ab78e | 17 | { |
sahilmgandhi | 0:a03c771ab78e | 18 | while (1) { |
sahilmgandhi | 0:a03c771ab78e | 19 | redLed.write(0); |
sahilmgandhi | 0:a03c771ab78e | 20 | wait_ms(1000); |
sahilmgandhi | 0:a03c771ab78e | 21 | redLed.write(1); |
sahilmgandhi | 0:a03c771ab78e | 22 | greenLed.write(0); |
sahilmgandhi | 0:a03c771ab78e | 23 | wait_ms(1000); |
sahilmgandhi | 0:a03c771ab78e | 24 | greenLed.write(1); |
sahilmgandhi | 0:a03c771ab78e | 25 | blueLed.write(0); |
sahilmgandhi | 0:a03c771ab78e | 26 | wait_ms(1000); |
sahilmgandhi | 0:a03c771ab78e | 27 | blueLed.write(1); |
sahilmgandhi | 0:a03c771ab78e | 28 | } |
sahilmgandhi | 0:a03c771ab78e | 29 | } |