Are you using the later Arduino IDE tweaks, I.E. SDK 1.0 Version?
I get a compile error:
volatile IO_REG_TYPE *basereg;
Like the hacked Solar unit Yep these units are not what they say on the tin lol.
Cheers Dans
Explore... Chat... Share...
Moderator: igrr
danbicks wrote:Thanks buddy,
Are you using the later Arduino IDE tweaks, I.E. SDK 1.0 Version?
I get a compile error:
volatile IO_REG_TYPE *basereg;
Like the hacked Solar unit Yep these units are not what they say on the tin lol.
Cheers Dans
#include <ESP8266WiFi.h>
extern "C" {
#include "user_interface.h"
uint16 readvdd33(void);
}
const char* ssid = "BTHub5-72W5";
const char* password = "xxx";
const char* host = "data.sparkfun.com";
const char* streamId = "EJ2omGv548HjV6mx3Njp";
const char* privateKey = "xxx";
const unsigned long SLEEP_INFTERVAL = 5 * 60 * 1000 * 1000; // 1 minutes
//const unsigned long SLEEP_INFTERVAL = 20 * 1000 * 1000; // 20 sec
float vdd;
void setup() {
vdd = readvdd33() / 1000.0;
Serial.begin(115200);
Serial.println();
Serial.print("Vdd: ");
Serial.println(vdd);
initWifi();
sendHello();
Serial.print("up time: ");
Serial.print(millis());
Serial.print(", deep sleep for ");
Serial.print(SLEEP_INFTERVAL / 1000000);
Serial.println(" secs...");
system_deep_sleep_set_option(1);
system_deep_sleep(SLEEP_INFTERVAL - micros()); // deep sleep for 15 minutes minus how long this reading was up for
delay(1000);
}
void loop() {
// should never get here
}
void sendHello() {
Serial.print("connecting to ");
Serial.println(host);
WiFiClient client;
const int httpPort = 80;
while (!client.connect(host, httpPort)) {
Serial.println("connection failed, retrying...");
}
String url = "/input/";
url += streamId;
url += "?private_key=";
url += privateKey;
url += "&vdd=";
url += vdd;
Serial.print("Requesting URL: ");
Serial.println(url);
client.print(String("GET ") + url);
client.print(String(" HTTP/1.1\r\n") +
"Host: " + host + "\r\n" +
"Connection: close\r\n\r\n");
delay(10);
while(client.available()){
String line = client.readStringUntil('\r');
Serial.print(line);
}
Serial.println();
Serial.println("closing connection");
client.stop();
}
void initWifi() {
Serial.print("current connect:{ ");
Serial.println(WiFi.SSID());
if (strcmp (WiFi.SSID(),ssid) != 0) {
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
wifi_station_set_auto_connect(true);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
}
Serial.println("");
Serial.print("WiFi connected in: ");
Serial.println(millis());
Serial.println();
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
It takes about 20-25 seconds for home assistant c[…]
I tried to upgrade tof my sonoff basic R2 with the[…]
a problem Perhaps you want to define "Probl[…]
Rebooting your router will not give you a faster I[…]
There are no other notifications from esptool.py i[…]
Using the Arduino IDE, you'll learn how to set up […]
In this project, you will post to Twitter using an[…]
In this project, we will build a water level contr[…]
I guess I'm late, but I had the same problem and f[…]
Last night I received my first D1 Minis for a lear[…]
Although I am aware that this is an old post, I fe[…]