martinbandung
Member since May 2020 • Last active Jul 2020Most recent activity
-
- 4 comments
- 2,121 views
-
so, i am interfacing esp8266 wemos d1 mini with atmega328. ATmega328 sending data to esp8266 using serial communication. I think the serial is not working correctly.
when i powered up 2 board,the esp can connect to my local mqtt and sending "no_data", even though i see on my atmega328 lcd that the data was sent correctly.
but when i connect to wemos using espruino ide over ip address. i magically can send the data to mqtt correctly.
i've tries several times, that i need to connect to esp through espruino program on computer as if it is "openning the lock" on my uart port on esp.
where is the mistake?
Serial1.setup(19200,{rx:D3,tx:D1}); var mqtt = require("tinyMQTT").create(server, { username: "a", password: "asdfghjkl", port: 1883 }); function konekwifi() { wifi.connect("qwer",{password:"asdfqwer"}, function(){ mqtt.connect(); }); } function kirimdata() { var bsplit=buff.split(","); if(buff!='' && bsplit.length>=3) { mqtt.publish("posisi/"+clientid, JSON.stringify( { 'name':clientid, 'lat':bsplit[0], 'lon':bsplit[1], 'pm':bsplit[2] })); } else { console.log(bsplit.length+'_no_data_'+buff); mqtt.publish("status/"+clientid, "no_data_"+bsplit.length); } } function onInit() { konekwifi(); wifi.stopAP(); setTimeout(function(){ if (wifi.getIP().ip!='0.0.0.0'){ console.log(wifi.getIP()); } else {konekwifi();} }, 15000); } //event handler Serial1.on('data', function (data) { buff=data; }); setInterval(kirimdata, 2000);
I solved the problem. I can do it after moving the console to Telnet. I read it on espruino documentation on the very bottom of the page.