Devices & Components
Arduino Esplora
Software & Tools
Android Sensors
Project description
Code
Esplora_free_fall.ino
arduino
The main code to sense free fall
1#include <Esplora.h> 2 3void setup() 4{ 5 Serial.begin(9600); 6} 7 8void loop() 9{ 10 long int xa = Esplora.readAccelerometer(X_AXIS); 11 long int ya = Esplora.readAccelerometer(Y_AXIS); 12 long int za = Esplora.readAccelerometer(Z_AXIS); 13 float at = sqrt(xa*xa + ya*ya + za*za); // total acceleration 14 Serial.print(xa); 15 Serial.print('\ '); 16 Serial.print(ya); 17 Serial.print('\ '); 18 Serial.print(za); 19 Serial.print('\ '); 20 Serial.print(at); 21 Serial.println(); 22 23 // since esplora accelerometer output is in 0 to 1023 range, we can assume that the acceleration during free fall will drop below value 50. 24 25 if (at < 50) { 26 Esplora.writeRGB(255,0,0); 27 } 28 else { 29 Esplora.writeRGB(0,0,0); 30 } 31 32 33 delay(10); 34} 35 36 37
Downloadable files
Esplora Sensors
The locations of various sensors on Arduino Esplora.
Esplora Sensors

Accelerometer Data
Complete Annotations to easily understand the free fall.
Accelerometer Data

Accelerometer Data
Complete Annotations to easily understand the free fall.
Accelerometer Data

Esplora Sensors
The locations of various sensors on Arduino Esplora.
Esplora Sensors

Comments
Only logged in users can leave comments