Update init.js
removed light sensor reading code, v1 hardware does not have it
This commit is contained in:
parent
9c7d94db93
commit
d9c2bd35de
|
@ -15,7 +15,6 @@ let resetPin = 0;
|
||||||
let statusLightPin = 16;
|
let statusLightPin = 16;
|
||||||
let dhtPin = 22;
|
let dhtPin = 22;
|
||||||
let moisturePin = 32;
|
let moisturePin = 32;
|
||||||
let lightPin = 34;
|
|
||||||
|
|
||||||
// Turn on status led
|
// Turn on status led
|
||||||
GPIO.set_mode(statusLightPin, GPIO.MODE_OUTPUT);
|
GPIO.set_mode(statusLightPin, GPIO.MODE_OUTPUT);
|
||||||
|
@ -55,14 +54,13 @@ let readSensors = Timer.set(5000, Timer.REPEAT, function() {
|
||||||
let t = dht.getTemp();
|
let t = dht.getTemp();
|
||||||
let h = dht.getHumidity();
|
let h = dht.getHumidity();
|
||||||
let m = ADC.read(moisturePin);
|
let m = ADC.read(moisturePin);
|
||||||
let l = ADC.read(lightPin);
|
|
||||||
|
|
||||||
print("DeviceId:",deviceId,"Temperature:",t,"Humidity:",h,"Moisture:",m,"Light:",l);
|
print("DeviceId:",deviceId,"Temperature:",t,"Humidity:",h,"Moisture:",m);
|
||||||
|
|
||||||
if (deviceId !== "" && connected)
|
if (deviceId !== "" && connected)
|
||||||
{
|
{
|
||||||
GPIO.write(statusLightPin, 1);
|
GPIO.write(statusLightPin, 1);
|
||||||
let jsonData = {'DeviceId': deviceId, 'Temperature': t, 'Humidity': h, 'Moisture': m, 'Light': l};
|
let jsonData = {'DeviceId': deviceId, 'Temperature': t, 'Humidity': h, 'Moisture': m};
|
||||||
HTTP.query({
|
HTTP.query({
|
||||||
headers: {'Content-Type' : 'application/json'},
|
headers: {'Content-Type' : 'application/json'},
|
||||||
url: 'http://httpbin.org/post', // replace with your own endpoint
|
url: 'http://httpbin.org/post', // replace with your own endpoint
|
||||||
|
|
Loading…
Reference in New Issue