My ELEC2645 project. Nikollao Sulollari. 200804685
Dependencies: N5110 SoftPWM mbed
Diff: main.cpp
- Revision:
- 15:c7af2ea5f164
- Parent:
- 14:91ae0afe9037
- Child:
- 16:a6ca6858af24
diff -r 91ae0afe9037 -r c7af2ea5f164 main.cpp --- a/main.cpp Fri Apr 29 14:19:57 2016 +0000 +++ b/main.cpp Fri Apr 29 19:35:13 2016 +0000 @@ -16,12 +16,12 @@ calibrateJoystick(); ///calibrate joystick button.rise(&button_isr); ///assign rise with ISR button1.rise(&button1_isr); + menu(); ticker.attach(&timer_isr,0.05); ///attach ticker with ISR every 0.1 sec reset = level; ///set reset = level to check later if level has increased // buzzer.start(); //buzzer.write(0.5); //buzzer.period_ms(4); - menu(); while (1) { @@ -34,14 +34,6 @@ enemies(); obstacles(); - if (heroY < -45) { ///if hero has reached the top of the screen - heroY = 0; ///hero goes back to the bottom of the screen - level++; ///level increases by 1 - } - - if (heroY >= 0) { - heroY = 0; - } if (reset < level) { ///if level has increased reset = level; ///update reset @@ -73,6 +65,12 @@ r_led = 1; g_led = 1; b_led = 1; + + blue_led = 1; + left_led = 1; + centre_led = 1; + right_led = 1; + // since the on-board switches have external pull-ups, we should disable the internal pull-down // resistors that are enabled by default using InterruptIn