1
0
mirror of https://github.com/daniviga/bite.git synced 2025-04-18 22:00:11 +02:00

Arduino minor optimizations

This commit is contained in:
Daniele Viganò 2020-06-05 13:23:19 +02:00
parent 02cb3bd042
commit ed0186a2ff
Signed by: dani
GPG Key ID: DB49AFC03C40EE02

View File

@ -16,8 +16,7 @@ JsonObject payload = telemetry.createNestedObject("payload");
JsonObject temp = payload.createNestedObject("temperature");
unsigned int counter = 0;
int tempPin = A0;
int photocellPin = A1;
EthernetUDP ntpUDP;
NTPClient timeClient(ntpUDP);
@ -31,7 +30,6 @@ netConfig config;
const String apiURL = "/api/device/subscribe/";
const String telemetryURL = "/telemetry/";
const int postDelay = 10 * 1000;
void setup(void) {
Serial.begin(9600);
@ -90,9 +88,10 @@ void setup(void) {
}
void loop(void) {
const int postDelay = 10 * 1000;
unsigned int photocellReading = analogRead(photocellPin);
unsigned int tempReading = analogRead(tempPin);
unsigned int tempReading = analogRead(A0);
unsigned int photocellReading = analogRead(A1);
float tempVoltage = tempReading * AREF_VOLTAGE / 1024.0;
float tempC = (tempVoltage - 0.5) * 100 ;