Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SHT30-DIS-B mbed
Fork of Skywire_Demo by
Diff: main.cpp
- Revision:
- 7:00d66e743603
- Parent:
- 5:977fa2ac1589
- Child:
- 8:060eaa992407
--- a/main.cpp Tue Mar 03 18:32:03 2015 +0000
+++ b/main.cpp Fri Jul 24 17:59:06 2015 +0000
@@ -1,4 +1,5 @@
/* main.cpp */
+ * v1.1
/* Copyright (C) 2015 nimbelink.com, MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
@@ -21,9 +22,10 @@
#include "LPS331.h"
#include "LIS3DH.h"
#include "LM75B.h"
+#include "hts221.h"
/* --CHANGE THIS FOR YOUR SETUP" -- */
-#define DeviceID "DweetIODeviceName" //Freeboard DweetIO unique ID
+#define DeviceID "A1000032BD4DAF" //Freeboard DweetIO unique ID
DigitalOut myled(LED1);
DigitalOut skywire_en(PA_6);
@@ -38,6 +40,7 @@
LPS331 pressure(i2c);
LM75B LM75_temp(PB_9,PB_8);
LIS3DH accel(i2c, LIS3DH_V_CHIP_ADDR, LIS3DH_DR_NR_LP_100HZ, LIS3DH_FS_2G);
+HTS221 humidity(PB_9, PB_8);
char str[255];
@@ -100,6 +103,8 @@
float axis[3];
float press;
float temp;
+ float humi;
+ float dummy_temp;
debug_pc.baud(115200);
@@ -136,6 +141,7 @@
// connect to dweet.io
skywire.printf("AT#HTTPCFG=1,\"dweet.io\",80,0\r\n");
WaitForResponse("OK", 2);
+
//get location approximation from cell tower information
skywire.printf("AT#AGPSSND\r\n");
@@ -144,6 +150,7 @@
//debug_pc.printf("Skywire says: %s\r\n", rx_line);
sscanf(rx_line, "%s %d,%f,%f,", str, &number, &latitude, &longitude);
debug_pc.printf("Location: Latt:%f, Long:%f\r\n", latitude, longitude);
+
wait(3);
while(1) {
@@ -151,12 +158,14 @@
debug_pc.printf("Temp = %.3f\r\n", temp);
press=(float)pressure.value() / 4096;
debug_pc.printf("Pressure = %.3f\r\n", press);
+ humidity.ReadTempHumi(&dummy_temp, &humi);
+ debug_pc.printf("Humidity = %.3f\r\n", humi);
accel.read_data(axis);
debug_pc.printf("Accel = %.3f, %.3f, %.3f\r\n", axis[0], axis[1], axis[2]);
- // wait(10);
+ //wait(10);
//Report Sensor Data to dweet.io
- skywire.printf("AT#HTTPQRY=1,0,\"/dweet/for/%s?temperature=%.3f&pressure=%.3f&X=%.3f&Y=%.3f&Z=%.3f&Latitude=%f&Longitude=%f\"\r\n", DeviceID, temp, press, axis[0], axis[1], axis[2], latitude, longitude);
+ skywire.printf("AT#HTTPQRY=1,0,\"/dweet/for/%s?temp=%.3f&press=%.3f&humi=%.3f&X=%.3f&Y=%.3f&Z=%.3f&Latitude=%f&Longitude=%f\"\r\n", DeviceID, temp, press, humi, axis[0], axis[1], axis[2], latitude, longitude);
WaitForResponse("#HTTPRING", 9);
skywire.printf("AT#HTTPRCV=1\r\n");
WaitForResponse("OK", 2);
