Skip to content

Commit 671ea3a

Browse files
committed
Checkpoint
- Work in progress
1 parent 4402ece commit 671ea3a

39 files changed

+811
-1294
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dependencies.DS2482-RK=0.0.3
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dependencies.MCP23008-RK=0.0.4
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dependencies.MAX7360-RK=0.0.1
2+
dependencies.MAX47x6-RK=0.0.1
3+
dependencies.AMCLCD-RK=0.0.2
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dependencies.SparkFun_ADS1015_Arduino_Library=2.3.0
2+
dependencies.MCP23008-RK=0.0.2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dependencies.SparkFun_MCP9600_Arduino_Library=1.0.3
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dependencies.Sensor_4_20mA_RK=0.0.1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dependencies.Sensor_4_20mA_RK=0.0.2
2+
dependencies.SparkFun_ADS1015_Arduino_Library=2.3.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dependencies.sht3x-i2c=1.0.0
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#include "Particle.h"
2+
3+
#include "tracker_config.h"
4+
#include "tracker.h"
5+
#include "sht3x-i2c.h"
6+
7+
SYSTEM_THREAD(ENABLED);
8+
SYSTEM_MODE(SEMI_AUTOMATIC);
9+
10+
PRODUCT_ID(TRACKER_PRODUCT_ID);
11+
PRODUCT_VERSION(TRACKER_PRODUCT_VERSION);
12+
13+
SerialLogHandler logHandler(115200, LOG_LEVEL_TRACE, {
14+
{ "app.gps.nmea", LOG_LEVEL_INFO },
15+
{ "app.gps.ubx", LOG_LEVEL_INFO },
16+
{ "ncp.at", LOG_LEVEL_INFO },
17+
{ "net.ppp.client", LOG_LEVEL_INFO },
18+
});
19+
20+
Sht3xi2c sensor(Wire3, 0x44);
21+
22+
void locationGenerationCallback(JSONWriter &writer, LocationPoint &point, const void *context); // Forward declaration
23+
24+
void setup()
25+
{
26+
Tracker::instance().init();
27+
28+
// Register a location callback so we can add temperature and humidity information
29+
// to location publishes
30+
Tracker::instance().location.regLocGenCallback(locationGenerationCallback);
31+
32+
// Turn on 5V output on M8 connector
33+
pinMode(CAN_PWR, OUTPUT);
34+
digitalWrite(CAN_PWR, HIGH);
35+
delay(500);
36+
37+
sensor.begin(CLOCK_SPEED_400KHZ);
38+
sensor.start_periodic();
39+
40+
Particle.connect();
41+
}
42+
43+
void loop()
44+
{
45+
Tracker::instance().loop();
46+
}
47+
48+
void locationGenerationCallback(JSONWriter &writer, LocationPoint &point, const void *context)
49+
{
50+
double temp, humid;
51+
52+
int err = sensor.get_reading(&temp, &humid);
53+
if (err == 0)
54+
{
55+
writer.name("sh31_temp").value(temp);
56+
writer.name("sh31_humid").value(humid);
57+
58+
Log.info("temp=%.2lf hum=%.2lf", temp, humid);
59+
}
60+
else {
61+
Log.info("no sensor err=%d", err);
62+
}
63+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dependencies.M8RelayRK=0.0.1

0 commit comments

Comments
 (0)