Update init.js

removed light sensor reading code, v1 hardware does not have it
This commit is contained in:
Latitude17 2018-03-03 15:07:41 -07:00 committed by GitHub
parent 9c7d94db93
commit d9c2bd35de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -15,7 +15,6 @@ let resetPin = 0;
let statusLightPin = 16;
let dhtPin = 22;
let moisturePin = 32;
let lightPin = 34;
// Turn on status led
GPIO.set_mode(statusLightPin, GPIO.MODE_OUTPUT);
@ -55,14 +54,13 @@ let readSensors = Timer.set(5000, Timer.REPEAT, function() {
let t = dht.getTemp();
let h = dht.getHumidity();
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)
{
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({
headers: {'Content-Type' : 'application/json'},
url: 'http://httpbin.org/post', // replace with your own endpoint