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 Code_APP3_R by
Accelerometer.cpp
00001 #include "Accelerometer.h" 00002 00003 I2C accel(p28, p27); 00004 bool bIsInitialized = false; 00005 00006 //--------------------------------------------------------------// 00007 // Fonction pour l'envoie de données de l'accéléromètre 00008 // Testé et fonctionnel 00009 //--------------------------------------------------------------// 00010 void func_accel(CArray* DATA_TO_SEND) 00011 { 00012 if (!bIsInitialized) 00013 { 00014 char activation[2] = {0x2A, 0x03}; 00015 char fullScale[2] = {0x0E, 0x00}; 00016 accel.write(0x3A, activation, 2, true); 00017 accel.write(0x3A, fullScale, 2, true); 00018 bIsInitialized = true; 00019 } 00020 DATA_TO_SEND->_ptr = new char[3]; 00021 accel.write(0x3A, DATA_TO_SEND->_ptr, 1, true); 00022 accel.read(0x3A, DATA_TO_SEND->_ptr, 3); 00023 DATA_TO_SEND->size = 3; 00024 } 00025 //--------------------------------------------------------------//
Generated on Mon Jul 18 2022 14:56:15 by
