summaryrefslogtreecommitdiff
path: root/sketch_apr09a.ino
diff options
context:
space:
mode:
authorOlivier Gayot <og@satcom1.com>2016-04-09 10:28:03 +0200
committerOlivier Gayot <og@satcom1.com>2016-04-09 10:28:03 +0200
commite55eca19ef0e0c03832e8195ec3a11ff4e3903ce (patch)
tree98195abd377f02d4cf5208c0cd2d501147367da7 /sketch_apr09a.ino
initial commit - read the raw values and send them
Signed-off-by: Olivier Gayot <og@satcom1.com>
Diffstat (limited to 'sketch_apr09a.ino')
-rw-r--r--sketch_apr09a.ino63
1 files changed, 63 insertions, 0 deletions
diff --git a/sketch_apr09a.ino b/sketch_apr09a.ino
new file mode 100644
index 0000000..8fc20cc
--- /dev/null
+++ b/sketch_apr09a.ino
@@ -0,0 +1,63 @@
+#include "Belt.h"
+#include "logs.h"
+
+Belt::Belt()
+{
+ _pin_pressure_bottom = 0;
+ _pin_pressure_top = 1;
+ _pin_flexion = 2;
+ _pin_gyro_x = 3;
+ _pin_gyro_y = 4;
+ _pin_gyro_z = 5;
+}
+
+void Belt::read_pressure_top()
+{
+ _pressure_top = analogRead(_pin_pressure_top);
+}
+void Belt::read_pressure_bottom()
+{
+ _pressure_bottom = analogRead(_pin_pressure_bottom);
+}
+void Belt::read_flexion()
+{
+ _flexion = analogRead(_pin_flexion);
+}
+void Belt::read_angle_x()
+{
+ _angle_x = analogRead(_pin_gyro_x);
+}
+void Belt::read_angle_y()
+{
+ _angle_y = analogRead(_pin_gyro_y);
+}
+void Belt::read_angle_z()
+{
+ _angle_z = analogRead(_pin_gyro_z);
+}
+
+static Belt belt;
+
+void setup()
+{
+ Serial.begin(9600);
+}
+
+void loop()
+{
+ delay(500);
+
+ belt.read_pressure_bottom();
+ belt.read_pressure_top();
+ belt.read_flexion();
+ belt.read_angle_x();
+ belt.read_angle_y();
+ belt.read_angle_z();
+
+ serial_printf("pressure bottom: %d\n", belt.get_pressure_bottom());
+ serial_printf("pressure top: %d\n", belt.get_pressure_top());
+ serial_printf("flexion: %d\n", belt.get_flexion());
+ serial_printf("angle x: %d\n", belt.get_angle_x());
+ serial_printf("angle y: %d\n", belt.get_angle_y());
+ serial_printf("angle z: %d\n", belt.get_angle_z());
+}