HomeACcessoryKid / ESP8266-HomeKit-Demo

User part of the ESP8266-HomeKit foundation
https://www.youtube.com/watch?v=Xnr-utWDIR8
Apache License 2.0
125 stars 27 forks source link

Temperature sensor #30

Open Maxmudjon opened 6 years ago

Maxmudjon commented 6 years ago

How to set value ?

HomeACcessoryKid commented 6 years ago

please see how the led gets SET by the timer. Create an integer cJSON object and treat it in a similar way.

Maxmudjon commented 6 years ago

here ?

void led_intr() { int new; static uint32 oldtime;

if ( (oldtime+200)<(oldtime=(system_get_time()/1000) ) ) {  //200ms debounce guard
    new=GPIO_INPUT(GPIO_Pin_2)^1; //get new state
    GPIO_OUTPUT(GPIO_Pin_2,new);       //toggle
    gpio2.value->type=42;
    change_value(    gpio2.aid,gpio2.iid,gpio2.value);
    send_events(NULL,gpio2.aid,gpio2.iid);
}

}

HomeACcessoryKid commented 6 years ago

yes