We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
すごい昔のissueでいまさらですが、MQTTではclientから定期的にpingを送らないといけないので、その実装がAdafruit_MQTT.cppにない可能性が有りますね。 例えばMilkcocoa.cpp側にping APIを追加して、ユーザのタイミングでpingするとかってどうですかね?
milk-cocoa/Milkcocoa_Arduino_SDK#3
The text was updated successfully, but these errors were encountered:
動作確認できたコード。5分以上放置しても、Arduino側でpushを受け取れた。 AppIdはお絵かき( https://mlkcca.com/sample.html )のもの。
#include <ESP8266WiFi.h> #include <Milkcocoa.h> /************************* WiFi Access Point *********************************/ #define WLAN_SSID "...SSID..." #define WLAN_PASS "...PASSWORD..." /************************* Your Milkcocoa Setup *********************************/ #define MILKCOCOA_APP_ID "dogi9jz8c16" #define MILKCOCOA_DATASTORE "dots" /************* Milkcocoa Setup (you don't need to change this!) ******************/ #define MILKCOCOA_SERVERPORT 1883 /************ Global State (you don't need to change this!) ******************/ // Create an ESP8266 WiFiClient class to connect to the MQTT server. WiFiClient client; const char MQTT_SERVER[] PROGMEM = MILKCOCOA_APP_ID ".mlkcca.com"; const char MQTT_CLIENTID[] PROGMEM = __TIME__ MILKCOCOA_APP_ID; Milkcocoa milkcocoa = Milkcocoa(&client, MQTT_SERVER, MILKCOCOA_SERVERPORT, MILKCOCOA_APP_ID, MQTT_CLIENTID); void onpush(DataElement *elem) { Serial.println("onpush"); Serial.println(elem->getInt("index")); }; void setupWiFi() { Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(WLAN_SSID); WiFi.begin(WLAN_SSID, WLAN_PASS); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); } void setup() { Serial.begin(115200); delay(10); Serial.println(F("Milkcocoa SDK demo")); setupWiFi(); Serial.println( milkcocoa.on(MILKCOCOA_DATASTORE, "push", onpush) ); }; void loop() { milkcocoa.loop(); milkcocoa.ping(); delay(7000); };
Sorry, something went wrong.
No branches or pull requests
milk-cocoa/Milkcocoa_Arduino_SDK#3
The text was updated successfully, but these errors were encountered: