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.
Dependencies: C12832 MMA7660 mbed
Diff: main.cpp
- Revision:
- 0:a19771db916c
- Child:
- 2:c2ebc7fa80eb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Oct 30 04:56:59 2015 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+#include "MMA7660.h" // accelerometer sensor
+#include "C12832.h" // LCD display
+
+
+// create an accelerometer object
+MMA7660 accelerometer(p28, p27);
+
+// LCD display
+C12832 lcd(p5, p7, p6, p8, p11);
+
+// joystick
+BusIn joystick(p15,p12,p13,p16);
+
+// LEDs
+BusOut LEDs(LED1,LED2,LED3,LED4);
+
+int main()
+{
+ // try to establish a connection with the accelerometer
+ if( !accelerometer.testConnection() )
+ {
+ // turn on all LEDs (indicating an error state)
+ LEDs = 0xf;
+ return 0;
+ }
+
+ // clear the LCD
+ lcd.cls();
+
+
+ // TODO: Move to the centre of the LCD and set the corresponding pixel to black
+ // We will call the current location the "active pixel"
+
+
+ // create an infinite loop (i.e., the program runs as long as the processor is on)
+ while(1)
+ {
+ // TODO: Get the state/value of the joystick
+
+
+ // TODO: Determine the coordinates of the next active pixel based on joystick data
+
+
+ // TODO: Set the next pixel to black
+
+
+ // TODO: Get the accelerometer measurements
+
+
+ // TODO: Check if the screen should be cleared based on the accelerometer
+ // measurements, and if so, clear the screen but don't move the active
+ // pixel.
+ //
+ // NOTE: Although you may have an idea of how to do this, it may take some
+ // "tuning" to get it to "feel right".
+
+
+
+ // wait a short period
+ wait(0.1);
+ }
+
+ // end of program
+ return 0;
+}