Post topics, source code that relate to the Arduino Platform

User avatar
By Samighi11
#1254
villTech wrote:i have not experienced garbage data when my hardware set up is all OK.
Have you tried connecting your esp module to a serial cable (usb to serial) and serial terminal to see what the esp module is actually transmitting?


the short answer is yes, but it a bit complicated to reproduce each of these cases. I will try with my PY serial harness and manually via terminal.

If i am reading you correctly, you are saying it is possible it is a cabling issue. (no need to comment, I will work based on both sets of feedback).
User avatar
By popcorn
#1309 Ok. I tried with the XMLhttpRequest now...

But the console said:
XMLHttpRequest cannot load http://192.168.1.101:8000/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

I tried to send the response to the browser...
*** TERMINAL ****
AT+CIPSEND=0,200
HTTP/1.1 200 OK\r\nAccess-Control-Allow-Origin: "*"\r\nContent-Type: text/html\r\nHello world!\r\n
AT+CIPCLOSE=0
**********************

**** HTML ****
<!DOCTYPE HTML>
<html>
<head>
<script>
var xmlhttp;

function loadXMLDoc(){


if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
console.log("readystate " + xmlhttp.readyState);
console.log("status " + xmlhttp.status);
console.log(xmlhttp.getAllResponseHeaders());
console.log(xmlhttp.responseText);

if (xmlhttp.readyState==4 && xmlhttp.status==200){
console.log(xmlhttp.responseText);
//document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","http://192.168.1.101:8000",true);
xmlhttp.send();
//console.log("status " + xmlhttp.status);
}

function send() {
xmlhttp.send("jooooo");
}

loadXMLDoc();
</script>
</head>
<body>
<div id="sse">
<a href="javascript:send()">Send</a>
</div>
</body>
</html>

**** / HTML ****