-
Notifications
You must be signed in to change notification settings - Fork 2
/
5_read_allSensors.mita
44 lines (36 loc) · 1.23 KB
/
5_read_allSensors.mita
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main;
import platforms.xdk110;
setup accelerometer {
bandwidth = BW_500Hz;
range = Range_8G; // 8G range convienently does not require a conversion into mg
}
setup Gyroscope_BMI160 {
range = Range_250s;
bandwidth = BW_10_7Hz;
}
var tempCorrection = 6.5975;
setup environment {
power_mode = Normal;
standby_time = 1000; // ms
temperature_oversampling = OVERSAMPLE_1X;
}
setup light {
manual_mode = false;
}
every 10 second {
var accx = accelerometer.x_axis.read();
var accy = accelerometer.y_axis.read();
var accz = accelerometer.z_axis.read();
println(`Accelerometer: \n x: ${accx}mg\n y: ${accy}mg\n z: ${accz}mg`);
var gyx = gyroscope.x_axis.read();
var gyy = gyroscope.y_axis.read();
var gyz = gyroscope.z_axis.read();
println(`Gyroscope x: ${gyx} y: ${gyy} z: ${gyz} [deg/s]`);
var humi = environment.humidity.read();
var pres : double = environment.pressure.read()/1000.0;
var temp : double = environment.temperature.read()/1000.0;
temp = temp - tempCorrection;
println(`Humidity ${humi} %%rh Pressure ${pres} kPa Temperature ${temp} degC`);
var light : double = light.intensity.read()/1000.00;
println(`Light: ${light} lux`);
}