Creating an IoT platform for smart agriculture. Collecting data and sending them to thingspeak for analysis

Dependencies:   DHT11 LPS22HB LSM6DSL VL53L0X

Revision:
0:07ff689741d2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CANbus.h	Fri Jun 08 12:00:02 2018 +0000
@@ -0,0 +1,33 @@
+#ifndef CANBUS_H
+#define CANBUS_H
+
+#include "mbed.h"
+
+/* Variables for collecting values */
+int battery_current, battery_voltage, Bat_SOC, speed, motorTemperature;
+
+/* Configure CAN pins */
+CAN can(D15, D14);
+
+/* Functions */
+struct VMS_Msg1 data_pack(int* data);
+void data_parse(struct VMS_Msg1 packed_data);
+
+#pragma pack(push, 1)
+struct VMS_Msg1{
+    int battery_current:16;
+    int battery_voltage:8;
+    int Bat_SOC:8;
+    int speed:8;
+    int motorTemperature:8;
+    int Gear:2;
+    int KeyLocation:2;
+    int downrating:1;
+    int AirCondEnable:1;
+    int PEPScert:2;
+    int ReadySignal:8;
+}VMS_Msg1;
+#pragma pack(pop)
+
+
+#endif