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.
Diff: main.cpp
- Revision:
- 0:d3a050703801
- Child:
- 1:9d69901e18d0
diff -r 000000000000 -r d3a050703801 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Apr 25 17:14:30 2016 +0000
@@ -0,0 +1,82 @@
+#include "mbed.h"
+#include "N5110.h"
+
+#define DIRECTION_TOLERANCE 0.05
+
+// VCC, SCE, RST, D/C, MOSI, SCLK, LED
+N5110 lcd (PTE26 , PTA0 , PTC4 , PTD0 , PTD2 , PTD1 , PTC3);
+
+// connections for joystick
+DigitalIn buttonJoy(PTB11);
+AnalogIn xPot(PTB2);
+AnalogIn yPot(PTB3);
+
+AnalogIn Pot1(PTB10);
+
+BusOut leds(LED1,LED2);
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+
+
+InterruptIn sw2 (SW2);
+DigitalIn buttonA(PTB18);
+DigitalIn buttonB(PTB19);
+PwmOut buzzer(PTA2);
+
+// timer to regularly read the joystick
+Ticker pollJoystick;
+
+enum DirectionName {
+ UP,
+ DOWN,
+ LEFT,
+ RIGHT,
+ CENTRE,
+ UNKNOWN
+};
+
+// struct for Joystick
+typedef struct JoyStick Joystick;
+struct JoyStick {
+ float x; // current x value
+ float x0; // 'centred' x value
+ float y; // current y value
+ float y0; // 'centred' y value
+ int button; // button state (assume pull-down used, so 1 = pressed, 0 = unpressed)
+ DirectionName direction; // current direction
+};
+// create struct variable
+Joystick joystick;
+
+int printFlag = 0;
+
+int main()
+{
+ lcd.init();
+ lcd.clear();
+ lcd.normalMode();
+ lcd.printString("Comet Crusher!",0,0);
+ lcd.printString("Start",10,2);
+ lcd.printString("Difficulty",10,3);
+ lcd.printString("Scores",10,4);
+ lcd.printString("Instructions",10,5);
+ lcd.printString(">",5,2);
+ while(1) {
+ }
+}
+
+void Game()
+{
+}
+
+void DifficultySet()
+{
+}
+
+void HighScore()
+{
+}
+
+void Instructions()
+{
+}