Framework for an Etch A Sketch program
Dependencies: mbed C12832 MMA7660
Diff: main.cpp
- Revision:
- 3:68eda0b14b6e
- Parent:
- 2:c2ebc7fa80eb
--- a/main.cpp Fri Oct 30 05:51:44 2015 +0000 +++ b/main.cpp Sat Nov 16 21:19:33 2019 +0000 @@ -1,8 +1,8 @@ #include "mbed.h" #include "MMA7660.h" // accelerometer sensor #include "C12832.h" // LCD display - - + + int main() { // create an accelerometer object @@ -16,7 +16,7 @@ // LEDs BusOut LEDs(LED1,LED2,LED3,LED4); - + // try to establish a connection with the accelerometer if( !accelerometer.testConnection() ) { @@ -24,38 +24,38 @@ 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); @@ -63,4 +63,4 @@ // end of program return 0; -} +} \ No newline at end of file