Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@1:7d8d28904f02, 2020-05-11 (annotated)
- Committer:
- namcheol
- Date:
- Mon May 11 13:03:34 2020 +0000
- Revision:
- 1:7d8d28904f02
- Parent:
- 0:f31836d48420
lab05-app-shield-joystick
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| dshin | 0:f31836d48420 | 1 | #include "mbed.h" |
| namcheol | 1:7d8d28904f02 | 2 | #include "C12832.h" |
| dshin | 0:f31836d48420 | 3 | |
| namcheol | 1:7d8d28904f02 | 4 | C12832 lcd(D11, D13, D12, D7, D10); //lcd = (MOSI, SCK, RESET, A0, nCS) |
| namcheol | 1:7d8d28904f02 | 5 | DigitalIn up(A2); |
| namcheol | 1:7d8d28904f02 | 6 | DigitalIn down(A3); |
| namcheol | 1:7d8d28904f02 | 7 | DigitalIn left(A4); |
| namcheol | 1:7d8d28904f02 | 8 | DigitalIn rite(A5); |
| namcheol | 1:7d8d28904f02 | 9 | DigitalIn center(D4); |
| dshin | 0:f31836d48420 | 10 | |
| dshin | 0:f31836d48420 | 11 | int main() |
| dshin | 0:f31836d48420 | 12 | { |
| namcheol | 1:7d8d28904f02 | 13 | lcd.cls(); //clear screen |
| namcheol | 1:7d8d28904f02 | 14 | lcd.locate(0, 6); |
| namcheol | 1:7d8d28904f02 | 15 | lcd.printf("Move Joystick!"); |
| namcheol | 1:7d8d28904f02 | 16 | while(true) { |
| namcheol | 1:7d8d28904f02 | 17 | if(up) { |
| namcheol | 1:7d8d28904f02 | 18 | lcd.locate(0,16); |
| namcheol | 1:7d8d28904f02 | 19 | lcd.printf("Up "); |
| namcheol | 1:7d8d28904f02 | 20 | } else if(down) { |
| namcheol | 1:7d8d28904f02 | 21 | lcd.locate(0,16); |
| namcheol | 1:7d8d28904f02 | 22 | lcd.printf("Down "); |
| namcheol | 1:7d8d28904f02 | 23 | } else if(left) { |
| namcheol | 1:7d8d28904f02 | 24 | lcd. locate(0,16); |
| namcheol | 1:7d8d28904f02 | 25 | lcd.printf("Left "); |
| namcheol | 1:7d8d28904f02 | 26 | } else if(rite) { |
| namcheol | 1:7d8d28904f02 | 27 | lcd.locate(0,16); |
| namcheol | 1:7d8d28904f02 | 28 | lcd.printf("Right "); |
| namcheol | 1:7d8d28904f02 | 29 | } else if(center) { |
| namcheol | 1:7d8d28904f02 | 30 | lcd.locate(0,16); |
| namcheol | 1:7d8d28904f02 | 31 | lcd.printf("Center "); |
| namcheol | 1:7d8d28904f02 | 32 | } |
| dshin | 0:f31836d48420 | 33 | } |
| dshin | 0:f31836d48420 | 34 | } |