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