Praktikum1_7_AMSL
Dependencies: C12832_lcd mbed
main.cpp@0:9419a34f07b4, 2018-03-07 (annotated)
- Committer:
- slueke
- Date:
- Wed Mar 07 18:51:47 2018 +0000
- Revision:
- 0:9419a34f07b4
Praktikum1_7
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
slueke | 0:9419a34f07b4 | 1 | #include "mbed.h" |
slueke | 0:9419a34f07b4 | 2 | #include "C12832_lcd.h" |
slueke | 0:9419a34f07b4 | 3 | |
slueke | 0:9419a34f07b4 | 4 | // LCD and Joystick Setting |
slueke | 0:9419a34f07b4 | 5 | C12832_LCD lcd; |
slueke | 0:9419a34f07b4 | 6 | |
slueke | 0:9419a34f07b4 | 7 | BusIn Up(p15); |
slueke | 0:9419a34f07b4 | 8 | BusIn Down(p12); |
slueke | 0:9419a34f07b4 | 9 | BusIn Left(p13); |
slueke | 0:9419a34f07b4 | 10 | BusIn Right(p16); |
slueke | 0:9419a34f07b4 | 11 | BusOut Reset(p14); |
slueke | 0:9419a34f07b4 | 12 | |
slueke | 0:9419a34f07b4 | 13 | unsigned short poti =0; |
slueke | 0:9419a34f07b4 | 14 | |
slueke | 0:9419a34f07b4 | 15 | // Custom Function |
slueke | 0:9419a34f07b4 | 16 | void initialize(); |
slueke | 0:9419a34f07b4 | 17 | void LCD_Anzeige(); |
slueke | 0:9419a34f07b4 | 18 | |
slueke | 0:9419a34f07b4 | 19 | AnalogIn input(p19); |
slueke | 0:9419a34f07b4 | 20 | |
slueke | 0:9419a34f07b4 | 21 | // Main |
slueke | 0:9419a34f07b4 | 22 | int main() |
slueke | 0:9419a34f07b4 | 23 | { |
slueke | 0:9419a34f07b4 | 24 | initialize(); |
slueke | 0:9419a34f07b4 | 25 | while(1) |
slueke | 0:9419a34f07b4 | 26 | { |
slueke | 0:9419a34f07b4 | 27 | |
slueke | 0:9419a34f07b4 | 28 | poti= input.read_u16(); |
slueke | 0:9419a34f07b4 | 29 | LCD_Anzeige(); |
slueke | 0:9419a34f07b4 | 30 | wait(0.1); |
slueke | 0:9419a34f07b4 | 31 | } |
slueke | 0:9419a34f07b4 | 32 | } |
slueke | 0:9419a34f07b4 | 33 | void initialize() |
slueke | 0:9419a34f07b4 | 34 | { |
slueke | 0:9419a34f07b4 | 35 | lcd.cls(); |
slueke | 0:9419a34f07b4 | 36 | lcd.locate(0,0); |
slueke | 0:9419a34f07b4 | 37 | lcd.printf("Hallo Bielefeld!"); |
slueke | 0:9419a34f07b4 | 38 | } |
slueke | 0:9419a34f07b4 | 39 | |
slueke | 0:9419a34f07b4 | 40 | |
slueke | 0:9419a34f07b4 | 41 | void LCD_Anzeige(){ |
slueke | 0:9419a34f07b4 | 42 | lcd.cls(); |
slueke | 0:9419a34f07b4 | 43 | lcd.locate(0,0); |
slueke | 0:9419a34f07b4 | 44 | lcd.printf("Hallo Bielefeld!"); |
slueke | 0:9419a34f07b4 | 45 | lcd.locate(0,15); // Set Location print a text |
slueke | 0:9419a34f07b4 | 46 | // Operations by Joystic |
slueke | 0:9419a34f07b4 | 47 | lcd.printf("%u",poti); |
slueke | 0:9419a34f07b4 | 48 | |
slueke | 0:9419a34f07b4 | 49 | } |