mirror of
https://github.com/daniviga/bite.git
synced 2024-11-22 21:16:12 +01:00
Minor README.md change [skip ci]
This commit is contained in:
parent
ddf6334b18
commit
fb92cd3198
32
README.md
32
README.md
|
@ -145,6 +145,38 @@ DOCKER_HOST='127.0.0.1:22375' docker-compose -f docker-compose.modules.yml up -d
|
|||
A simple Arduino UNO sketch is provided in the `arduino/tempLightSensor` folder.
|
||||
The sketch reads temperature and light from sensors.
|
||||
|
||||
```c
|
||||
/* ... */
|
||||
|
||||
void loop(void) {
|
||||
const int postDelay = 10 * 1000;
|
||||
|
||||
unsigned int tempReading = analogRead(A0);
|
||||
unsigned int photocellReading = analogRead(A1);
|
||||
|
||||
float tempVoltage = tempReading * AREF_VOLTAGE / 1024.0;
|
||||
float tempC = (tempVoltage - 0.5) * 100 ;
|
||||
|
||||
if (NTPValid) {
|
||||
telemetry["clock"] = timeClient.getEpochTime();
|
||||
} else {
|
||||
telemetry["clock"] = NULL; // converted into 0
|
||||
}
|
||||
payload["light"] = photocellReading;
|
||||
|
||||
temp["celsius"] = tempC;
|
||||
temp["raw"] = tempReading;
|
||||
temp["volts"] = tempVoltage;
|
||||
|
||||
#if USE_MQTT
|
||||
publishData(config, telemetry);
|
||||
#else
|
||||
postData(config, telemetryURL, telemetry);
|
||||
#endif
|
||||
|
||||
/* ... */
|
||||
```
|
||||
|
||||
[Read more ...](./arduino/README.md)
|
||||
|
||||
## Testing
|
||||
|
|
Loading…
Reference in New Issue
Block a user