-
• #2
Have you set the baud rate up? It should be 115200 for ESP8266
-
• #3
Hi @user79559,
- first you connect over serial with baud rate 1152000 COM14
Device found {"bitrate":115200,"bufferSize":4096,"connectionId":5,"ctsFlowControl":false,"dataBits":"eight","name":"","parityBit":"no","paused":true,"persistent":false,"receiveTimeout":0,"sendTimeout":0,"stopBits":"one"}
[success] Connected to .\COM14
Connected to .\COM14- send some code
Found a prompt... great!
Sending...
---> "\u0010reset();\n\u0010var ESP8266 = require(\"ESP8266\"),\u001b\n wifi = require(\"Wifi\");\n\u0010\u001b[4dfunction onInit() {\u001b\n wifi.connect(\"LP82K1\", {password: \"excitedboat325\"}, function(err) {\u001b\n if(err)console.log(err);else {\u001b\n console.log(\"wifi connected!\");//116\u001b\n print(wifi.getIP().ip);\u001b\n\u001b\n }\u001b\n });\u001b\n}\n\n"
Splitting for reset(), delay 250
Sent
Disconnect callback...
WARNING: [notify_warn] Disconnected
Disconnected
Connecting...
Set Slow Write = true
Connected [object Object]- try to connect via telnet
Device found {"socketId":5}
[success] Connected to TCP/IP: 192.168.0.121:23 (No response from board)Connected to TCP/IP: 192.168.0.121:23 (No response from board)
Please share what you try to achieve, so someone might point you to documents or code snippets to support you.
- first you connect over serial with baud rate 1152000 COM14
-
• #4
var settings_pol = 20; var settings_kondey = 24; var last_temp = 0; var temp_pol = 0; var dalas = setInterval(function() { require("DS18B20").connect(new OneWire(D13)).getTemp(function (temp) { print("Temp is "+temp+"°C"); if(temp!==null){ if(temp<settings_pol)digitalWrite(D14, true); if(temp>settings_pol)digitalWrite(D14, false); temp_pol = temp; } else digitalWrite(D14, false); }); }, 10000); function start_sensor(){ var dht_senso = setInterval(function() { require("DHT22").connect(D12).read(function (a) { print("Temp is "+a.temp.toString()+" and RH is "+a.rh.toString()); if(a.temp != -1){ if(a.temp>(settings_kondey+0.3))digitalWrite(D4, true); if(a.temp<settings_kondey)digitalWrite(D4, false); // if(a.temp!=last_temp){ setTimeout(function () { mqtt.publish("test", "{\"temp\":"+a.temp+",\"hum\":"+a.rh+",\"temp_pol\":"+temp_pol+",\"settings_kondey\":"+settings_kondey+",\"settings_pol\":"+settings_pol+"}");},1000); // last_temp = a.temp; // } }else digitalWrite(D4, false); }); }, 5000); } var server = "192.168.0.182"; // the ip of your MQTT broker var options = { // ALL OPTIONAL - the defaults are below client_id : "random", // the client ID sent to MQTT - it's a good idea to define your own static one based on `getSerial()` keep_alive: 60, // keep alive time in seconds port: 1883, // port number clean_session: true, //username: "home", // default is undefined //password: "789456", // default is undefined protocol_name: "MQTT", // or MQIsdp, etc.. protocol_level: 4, // protocol level }; var mqtt = require("MQTT").create(server, options /*optional*/); function reboot(){ print("reboot..."); ESP8266.reboot(); } var ESP8266 = require("ESP8266"), wifi = require("Wifi"); //var ssid = "Electrolux"; //var options = {password: "12345678"}; function onInit() { setTimeout(reboot,18000000); wifi.stopAP(); //wifi.startAP(ssid, options); //wifi.startAP("Electrolux"); // wifi.connect("INGRIFABSR", {password: "B73vFeX6se2"}, function(err) { wifi.connect("LP82K1", {password: "excitedboat325"}, function(err) { if(err)console.log(err);else { console.log("wifi connected!");//116 print(wifi.getIP().ip); mqtt.on('connected', function() { mqtt.subscribe("settings"); print("mqtt connected!"); start_sensor(); }); mqtt.on('publish', function (pub) { console.log("topic: "+pub.topic); console.log("message: "+pub.message); var settings=[]; if(pub.topic==="settings")settings = JSON.parse(pub.message); settings_pol = settings.settings_pol; settings_kondey = settings.settings_kondey; }); mqtt.connect(); mqtt.on('disconnected', function() { console.log("MQTT disconnected... reconnecting."); setTimeout(function() { mqtt.connect(); }, 10000); }); } }); }
-
• #5
cool, thanks for sharing.
ERROR: [notify_error] Unable to retrieve board information. Connection Error?
Is this still a issue?
-
• #6
Is this still a issue?
After flashing this code, the module becomes unavailable via wifi for the espruino ide. There is a connection only through com port. What's the problem, help. -
• #7
If you load the code without the MQTT library, everything works fine
-
• #8
Connecting...
Set Slow Write = true
Failed to open socket 192.168.0.121:23
ERROR: Unable to open device (connectionInfo=undefined)
ERROR: [notify_error] Connection Failed.
Connection Failed. -
• #9
after I give the command mqtt.connect(); pings go missing
-
• #10
Hmm, try to use tinyMQTT
-
• #11
I apologize for the uninteresting post. I found the problem. The problem was that the router was tilted Mac address of the PC. Therefore, the router blocked the connection.
Now everything works just fine and I'm very happy :) -
• #12
Glad you found it. Have fun with Espruino and think about $Donate 😉
Initialising Status
Initialising App
Initialising File
Initialising Code
Initialising Serial
Initialising Terminal
Initialising CodeWriter
Initialising Modules
Initialising Env
Initialising Flasher
Initialising EditorBlockly
Initialising EditorJavaScript
Initialising Send
Initialising MenuPortSelector
Initialising MenuSettings
Initialising MenuFlasher
Initialising SettingsAbout
Initialising SettingsFlasher
Initialising BoardJSON
Initialising VersionChecker
Initialising Compiler
Initialising Assembler
Initialising GetGitHub
Initialising Unicode
Initialising Minify
Initialising SaveOnSend
Initialising SetTime
Initialising Tutorial
Initialising Webcam
Initialising FontSize
Initialising UiMode
Initialising URLHandler
Initialising CodeLink
Initialising Project
Initialising Testing
Initialising Notification_Sound
Initialising Tern
Initialising Debugger
Initialising Tour
Initialising SettingsProfile
Initialising HelpLinks
Initialising Offline
Initialising CoreModules
Loaded code from storage.
GET chrome.storage.local.OFFLINE_DATA = 0 bytes
No navigator.bluetooth - Web Bluetooth not enabled
>>> Connecting...
Set Slow Write = true
>>> Connecting...
Set Slow Write = true
[object Object]
Connected [object Object]
Received a prompt after sending newline... good!
>>> Sending...
---> "\u0010print(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
>>> Sent
Got "< << {\"VERSION\":\"2v01\",\"GIT_COMMIT\":\"748a4d3\",\"BOARD\":\"ESP8266_4MB\",\"FLASH\":0,\"RAM\":81920,\"SERIAL\":\"ecfabc01-c8d9\",\"CONSOLE\":\"Serial1\",\"MODULES\":\"Flash,Storage,heatshrink,net,dgram,http,NetworkJS,Wifi,ESP8266,TelnetServer,crypto,neopixel\",\"EXPTR\":1073643636} >> >\r\n>"
[notify_info] Found ESP8266_4MB, 2v01
Loading http://www.espruino.com/json/ESP8266_4MB.json
Board JSON loaded
Set Slow Write = true
FIRMWARE: Current 2v01, Available 2v02
Device found {"bitrate":115200,"bufferSize":4096,"connectionId":5,"ctsFlowControl":false,"dataBits":"eight","name":"","parityBit":"no","paused":true,"persistent":false,"receiveTimeout":0,"sendTimeout":0,"stopBits":"one"}
[success] Connected to \.\COM14
>>> Connected to \.\COM14
Failed to open socket 192.168.0.121:23
ERROR: Unable to open device (connectionInfo=undefined)
ERROR: [notify_error] Connection Failed.
>>> Connection Failed.
SET chrome.storage.sync = {"AUTO_SAVE_CODE":true,"BAUD_RATE":"115200","BLOCKLY_EXTENSIONS":"|bluetooth|robot|","BLOCKLY_LANGUAGE":"en","BLOCKLY_TO_JS":false,"BOARD_JSON_URL":"http://www.espruino.com/json","CODE":"var ESP8266 = require(\"ESP8266\"),\n wifi = require(\"Wifi\");\n\nfunction onInit() {\n wifi.connect(\"LP82K1\", {password: \"excitedboat325\"}, function(err) {\n if(err)console.log(err);else {\n console.log(\"wifi connected!\");//116\n print(wifi.getIP().ip);\n\n }\n });\n}\n","COMPILATION":true,"COMPILATION_URL":"https://www.espruino.com/service/compiler","DISABLE_CODE_HINTS":false,"ENABLE_Testing":false,"ENV_ON_CONNECT":true,"FONT_SIZE":12,"MINIFICATION_DeadCode":true,"MINIFICATION_LEVEL":"","MINIFICATION_Literal":true,"MINIFICATION_Mangle":true,"MINIFICATION_Unreachable":true,"MINIFICATION_Unused":true,"MODULE_AS_FUNCTION":true,"MODULE_EXTENSIONS":".min.js|.js","MODULE_MINIFICATION_LEVEL":"ESPRIMA","MODULE_PROXY_ENABLED":false,"MODULE_PROXY_PORT":"","MODULE_PROXY_URL":"","MODULE_URL":"https://www.espruino.com/modules","OFFLINE_DATA":"","OFFLINE_DATA_DOWNLOAD":"","OFFLINE_DATA_UPLOAD":"","OFFLINE_ENABLED":false,"RESET_BEFORE_SEND":true,"SAVE_ON_SEND":0,"SERIAL_AUDIO":"0","SERIAL_IGNORE":"/dev/ttyS*|/dev/*.SOC|/dev/*.MALS","SERIAL_TCPIP":"192.168.0.121:23","SERIAL_THROTTLE_SEND":false,"SET_TIME_ON_WRITE":false,"SHOW_CODE_LINK_ICON":false,"SHOW_WEBCAM_ICON":0,"STORE_LINE_NUMBERS":true,"Sound_Error":"","Sound_Info":"","Sound_Success":"","Sound_Warning":"","Speak_Error":false,"Speak_Info":false,"Speak_Success":false,"Speak_Warning":false,"UI_MODE":"Normal","WEBCAM_CONSTRAINTS":0,"WEB_BLUETOOTH":true}
>>> Minifying
>>> Minification complete
Found a prompt... great!
>>> Sending...
---> "\u0010reset();\n\u0010var ESP8266 = require(\"ESP8266\"),\u001b\n wifi = require(\"Wifi\");\n\u0010\u001b[4dfunction onInit() {\u001b\n wifi.connect(\"LP82K1\", {password: \"excitedboat325\"}, function(err) {\u001b\n if(err)console.log(err);else {\u001b\n console.log(\"wifi connected!\");//116\u001b\n print(wifi.getIP().ip);\u001b\n\u001b\n }\u001b\n });\u001b\n}\n\n"
Splitting for reset(), delay 250
>>> Sent
Disconnect callback...
WARNING: [notify_warn] Disconnected
>>> Disconnected
>>> Connecting...
Set Slow Write = true
Connected [object Object]
Got ""
No Prompt found, got undefined - issuing Ctrl-C to try and break out
Splitting for Ctrl-C, delay 250
Still no prompt - issuing another Ctrl-C
Splitting for Ctrl-C, delay 250
>>> Sending...
---
WARNING: No result found for "process.env" - just got ""
ERROR: [notify_error] Unable to retrieve board information. Connection Error?
Device found {"socketId":5}
[success] Connected to TCP/IP: 192.168.0.121:23 (No response from board)
>>> Connected to TCP/IP: 192.168.0.121:23 (No response from board)