mirror of
https://github.com/kevinveenbirkenbach/physical-interface.git
synced 2024-11-14 14:21:04 +01:00
Added LDR
This commit is contained in:
parent
e2a19fdc76
commit
d89cac59cb
@ -29,6 +29,7 @@ const int pin_pir = 14;
|
|||||||
const int pin_tmp = 12;
|
const int pin_tmp = 12;
|
||||||
const uint16_t pin_ir_reciever = 2;
|
const uint16_t pin_ir_reciever = 2;
|
||||||
const uint16_t pin_ir_send = 4;
|
const uint16_t pin_ir_send = 4;
|
||||||
|
const uint16_t pin_ldr = A0;
|
||||||
const unsigned long ritter_group_address = 13043702;
|
const unsigned long ritter_group_address = 13043702;
|
||||||
const char* parameter_plug_id="plug_id";
|
const char* parameter_plug_id="plug_id";
|
||||||
const char* parameter_plug_status="plug_status";
|
const char* parameter_plug_status="plug_status";
|
||||||
@ -135,19 +136,23 @@ void controller(void){
|
|||||||
|
|
||||||
|
|
||||||
String getJsonDht(void){
|
String getJsonDht(void){
|
||||||
return "{\"temperature\":\""+String(dht.readTemperature())+"\",\"humidity\":\""+String(dht.readHumidity())+"\"}";
|
return "{\"temperature_celcius\":\""+String(dht.readTemperature())+"\",\"humidity\":\""+String(dht.readHumidity())+"\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
String getJsonPir(void){
|
String getJsonPir(void){
|
||||||
return "{\"motion\":\""+String(digitalRead(pin_pir))+"\"}";
|
return "{\"motion\":\""+String(digitalRead(pin_pir))+"\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getJsonLdr(void){
|
||||||
|
return "{\"relative\":\""+String(analogRead (pin_ldr))+"\"}";
|
||||||
|
}
|
||||||
|
|
||||||
String getJsonIrLastRecieved(void){
|
String getJsonIrLastRecieved(void){
|
||||||
return "{\"last_recieved\":{\"bits\":\""+String(last_recieved_ir_bits)+"\",\"type\":\""+String(last_recieved_ir_type)+"\",\"data\":\""+String(last_recieved_ir_data)+"\"}}";
|
return "{\"last_recieved\":{\"bits\":\""+String(last_recieved_ir_bits)+"\",\"type\":\""+String(last_recieved_ir_type)+"\",\"data\":\""+String(last_recieved_ir_data)+"\"}}";
|
||||||
}
|
}
|
||||||
|
|
||||||
String getJson(void){
|
String getJson(void){
|
||||||
return "{\"DHT\":"+String(getJsonDht())+",\"PIR\":"+String(getJsonPir())+",\"IR\":"+String(getJsonIrLastRecieved())+"}";
|
return "{\"LDR\":"+String(getJsonLdr())+",\"DHT\":"+String(getJsonDht())+",\"PIR\":"+String(getJsonPir())+",\"IR\":"+String(getJsonIrLastRecieved())+"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "homepage_template.h"
|
#include "homepage_template.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user