Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Application by
main.cpp
00001 #include "mbed.h" 00002 #include "USBMouse.h" 00003 #include "USBSerial.h" 00004 #include "MMA8451Q.h" 00005 00006 DigitalOut myled(LED1); 00007 USBMouse mouse; 00008 //USBSerial serial; 00009 #define MMA8451_I2C_ADDRESS (0x1d<<1) 00010 00011 int main() { 00012 //USBSerial usbSerial; 00013 MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); 00014 float x, y, z; 00015 00016 while (1) { 00017 x = (acc.getAccX()*10); 00018 y = (acc.getAccY()*10); 00019 z = (acc.getAccZ()*10); 00020 printf("X: %1.2f, Y: %1.2f, Z: %1.2f\n", x, y, z); 00021 mouse.move(x, y); 00022 wait(0.01); 00023 } 00024 }
Generated on Tue Jul 12 2022 17:28:29 by
1.7.2
