You can use your FRDM-K64F device as a joypad.
Check my repo for a compatible game using K64F. Currently works on Max OSX, can be implemented on Linux by changing Serial Port configuration.
Revision 0:9c531a8dcb06, committed 2016-02-24
- Comitter:
- co838_gtvl2
- Date:
- Wed Feb 24 19:55:15 2016 +0000
- Child:
- 1:cb4a1b11de74
- Commit message:
- If poked via Serial, it displays the current state of the accelerometer.; Uses sleep and interrupt to save energy.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FXOS8700Q.lib Wed Feb 24 19:55:15 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/JimCarver/code/FXOS8700Q/#5553a64d0762
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Feb 24 19:55:15 2016 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "FXOS8700Q.h" + +Serial pc(USBTX, USBRX); +FXOS8700Q_acc accel(PTE25, PTE24, FXOS8700CQ_SLAVE_ADDR1); + +void pc_interrupt(void) +{ + pc.getc(); + wait(.01); + int16_t accX, accY, accZ; + accel.getX(&accX); + accel.getY(&accY); + accel.getZ(&accZ); + pc.printf("%d;%d;%d\r\n", accX, accY, accZ); +} + +int main(void) +{ + pc.baud(38400); + pc.attach(&pc_interrupt); + + accel.enable(); + while (true) { + sleep(); + } + accel.disable(); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Feb 24 19:55:15 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/252557024ec3 \ No newline at end of file