An example program for the mbed application board that uses the joystick button. LED1,2,3,4 light in sequence with up, down, left, right, and pushing the button lights them all. Note that the orientation is looking at the screen in landscape,with the row of connectors at the bottom

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 BusIn joy(p15,p12,p13,p16);
00004 DigitalIn fire(p14);
00005 
00006 BusOut leds(LED1,LED2,LED3,LED4);
00007 
00008 int main()
00009 {
00010     while(1) {
00011         if (fire) {
00012             leds=0xf;
00013         } else {
00014             leds=joy;
00015         }
00016         wait(0.1);
00017     }
00018 }