You twist a knob to scroll (velocity sensing), and click the knob to select the character
Dependencies: mbed
Revision 0:c8531003d8f3, committed 2014-09-22
- Comitter:
- ohcolinho
- Date:
- Mon Sep 22 13:11:54 2014 +0000
- Commit message:
- initial commit;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Sep 22 13:11:54 2014 +0000 @@ -0,0 +1,55 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); + +//declare digitalIn pins (A0 - A4) +DigitalIn enable0(PTB0); +DigitalIn enable1(PTB1); +DigitalIn enable2(PTB2); +DigitalIn enable3(PTB3); +DigitalIn enable4(PTC2); + + +DigitalOut ledG(LED_GREEN); +DigitalOut ledR(LED_RED); + +int main() { + //setup stuff + //enable all internal pullup resistors + enable0.mode(PullUp); + enable1.mode(PullUp); + enable2.mode(PullUp); + enable3.mode(PullUp); + enable4.mode(PullUp); + + + while(1) { //main loop + //poll all the switches ( I know this is inefficient but I'm too lazy to do interrupts and its 3 am... + if(!enable2) { + printf("rright\n"); + } + else if(!enable3) { + printf("lleft\n"); + } + else if(!enable0) { + printf("left\n"); + ledR = 0; + ledG = 1; + } + else if(!enable1) { + printf("right\n"); + ledR = 1; + ledG = 0; + } + else if(!enable4) { + printf("push\n"); + } + else { + printf("notpush\n"); + ledR = 0; + ledG = 0; + } + + + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Sep 22 13:11:54 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/3d0ef94e36ec \ No newline at end of file