QAQ ==!
Dependencies: mbed QEI-1 nRF24L01P xiugai
main.cpp
- Committer:
- zhangyx
- Date:
- 2019-11-14
- Revision:
- 11:ddfcd88f3a30
- Parent:
- 10:cda7ae2fc9de
- Child:
- 12:741de117e1ee
File content as of revision 11:ddfcd88f3a30:
#define HIGH 1 #define LOW 0 #include "mbed.h" #include <string> typedef bool boolean; typedef std::string String; #include "sensors.h" #include "esp8266.h" #include "converters.h" int val; sr501 sr501_PA_0(PA_0); int main() { Esp8266 Esp8266client_(PA_9, PA_10, "hh", "12345678"); const char* esp8266sensors_[][2] = {{"SR501",""},{NULL,NULL}}; const char* esp8266actuators_[][2] = {{NULL,NULL}}; Esp8266client_.connect_mqtt_broker("101.6.161.196", "node2", esp8266sensors_, esp8266actuators_); while (true) { if (sr501_PA_0==true) { val = sr501_PA_0.read(); // ????? // // /values/<????????????cangku??>/# // // ??????????? // // /events/<????????????cangku??>/online Esp8266client_.publish_value("SR501", (val)); wait_ms(2000); } } }