Chris Styles
/
DemoBoard_EtchASketch
Revision 0:159c4d4552b7, committed 2009-09-19
- Comitter:
- chris
- Date:
- Sat Sep 19 01:33:42 2009 +0000
- Child:
- 1:95cd28d01d06
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lwip.lib Sat Sep 19 01:33:42 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_unsupported/code/lwip/ \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Sep 19 01:33:42 2009 +0000 @@ -0,0 +1,47 @@ +#include "Objects.h" + +/* + * This project uses the LCD, the two pots, and the three buttons to make a simple + * Etch-a-Sketch. Set the colour using the buttons, and use the pots to draw! + * Oh yeah, more than 1.5 in any axis will clear the screen :-) + */ + +int colour = 0x0; + +// Functions to set the colour +void RedRise() { colour = 0xff0000;} +void GreenRise() { colour = 0x00ff00;} +void BlueRise() { colour = 0x0000ff;} + +int main() { + + + // Attach the colour set functions to + // rising edge interrupt handlers + RedButton.rise(&RedRise); + GreenButton.rise(&GreenRise); + BlueButton.rise(&BlueRise); + + // set the screen background to white + lcd.fill(0,0,130,130,0xffffff); + + while(1) { + // fetch the values from the pots, and scale them to 0-130 + int x = potx * 130; + int y = poty * 130; + + // draw the pixel! + lcd.pixel(x,y,colour); + wait(0.01); + + // If any axis of the accelerometer read > 1.5g, clear the screen + if ( (acc.x() > 1.5) || (acc.y() > 1.5) || (acc.x() > 1.5) ) { + lcd.cls(); + lcd.fill(0,0,130,130,0xffffff); + } + + } + +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Sep 19 01:33:42 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/f63353af7be8