Early commits of my project
Dependencies: mbed Gamepad N5110
Diff: main.cpp
- Revision:
- 1:c80162894831
- Parent:
- 0:9e5f9e1c8ef9
- Child:
- 2:ba653520a140
diff -r 9e5f9e1c8ef9 -r c80162894831 main.cpp --- a/main.cpp Mon Mar 11 18:28:46 2019 +0000 +++ b/main.cpp Mon Mar 11 19:29:50 2019 +0000 @@ -4,7 +4,7 @@ N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Joystick joystick(PTB10,PTB11,PTC16); -AnalogIn contrast(PTB2); +AnalogIn pot0(PTB2); DigitalIn joy_button(PTC16); BusOut front_leds(PTA1,PTA2,PTC2,PTC3,PTC4, PTD3); @@ -12,8 +12,11 @@ { init(); + + while (1) { - + + contrast(); } } @@ -21,5 +24,18 @@ void init() { lcd.init(); + lcd.normalMode(); // normal colour mode + lcd.setBrightness(0.5); // put LED backlight on 50% + lcd.refresh(); + + joystick.init(); front_leds = 0b111111; +} + +void contrast() +{ + lcd.refresh(); + float con = pot0.read(); + lcd.setContrast(con); + } \ No newline at end of file