Robert Tomczak
/
TP3_app-shield-joystick
TPN°3 joystick BTS SNEC Amiens
Fork of app-shield-joystick by
main.cpp@2:507020c78d79, 2014-02-06 (annotated)
- Committer:
- chris
- Date:
- Thu Feb 06 15:37:09 2014 +0000
- Revision:
- 2:507020c78d79
- Parent:
- 1:c409f3abab09
- Child:
- 4:dd6d3b44dcb9
First check in
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:0325ecbd1916 | 1 | #include "mbed.h" |
chris | 0:0325ecbd1916 | 2 | |
chris | 2:507020c78d79 | 3 | DigitalOut red_led(D5); |
chris | 2:507020c78d79 | 4 | DigitalOut blue_led(D8); |
chris | 2:507020c78d79 | 5 | DigitalOut green_led(D9); |
chris | 0:0325ecbd1916 | 6 | |
chris | 2:507020c78d79 | 7 | DigitalIn up(A2); |
chris | 2:507020c78d79 | 8 | DigitalIn down(A3); |
chris | 2:507020c78d79 | 9 | DigitalIn left(A4); |
chris | 2:507020c78d79 | 10 | AnalogIn right(A5); |
chris | 2:507020c78d79 | 11 | DigitalIn fire(D4); |
chris | 0:0325ecbd1916 | 12 | |
chris | 0:0325ecbd1916 | 13 | |
chris | 0:0325ecbd1916 | 14 | int main() |
chris | 0:0325ecbd1916 | 15 | { |
chris | 0:0325ecbd1916 | 16 | |
chris | 2:507020c78d79 | 17 | while (1) { |
chris | 2:507020c78d79 | 18 | red_led = !up && ! fire; |
chris | 2:507020c78d79 | 19 | blue_led = !down; |
chris | 2:507020c78d79 | 20 | green_led= !left && !right; |
chris | 2:507020c78d79 | 21 | } |
chris | 0:0325ecbd1916 | 22 | } |
chris | 0:0325ecbd1916 | 23 | |
chris | 0:0325ecbd1916 | 24 |