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.
Dependencies: TextLCD3libreriatexlcd mbed
Fork of MMA8451Q by
main.cpp
00001 #include "mbed.h" 00002 #include "MMA8451Q.h" 00003 #include "TextLCD.h" 00004 #define MMA8451_I2C_ADDRESS (0x1d<<1) 00005 00006 TextLCD lcd(PTB10,PTB11,PTE2,PTE3,PTE4,PTE5); 00007 00008 MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); 00009 00010 float sensor_data[3]; 00011 00012 int main(){ 00013 lcd.locate(0,0); 00014 lcd.printf("Tarea Acelerometro"); 00015 wait(2); 00016 lcd.cls(); 00017 lcd.locate(0,0); 00018 lcd.printf("X:"); 00019 lcd.locate(7,0); 00020 lcd.printf("Y:"); 00021 lcd.locate(0,1); 00022 lcd.printf("Z:"); 00023 while(1){ 00024 00025 acc.getAccAllAxis( &sensor_data[0]); 00026 lcd.locate(2,0); 00027 lcd.printf(" "); 00028 lcd.locate(2,0); 00029 lcd.printf("%.2f",sensor_data[2]); 00030 lcd.locate(9,0); 00031 lcd.printf(" "); 00032 lcd.locate(9,0); 00033 lcd.printf("%.2f",sensor_data[0]); 00034 lcd.locate(3,1); 00035 lcd.printf(" "); 00036 lcd.locate(3,1); 00037 lcd.printf("%.2f",sensor_data[1]); 00038 wait(1); 00039 00040 } 00041 00042 00043 }
Generated on Wed Jul 13 2022 02:11:28 by
1.7.2
