-->
Page 1 of 1

Using NODEMCU to make "POST" data to web server

PostPosted: Thu Oct 21, 2021 10:13 am
by lightsoulnwo
Hello everybody

Im making a project that uses ESP8266 and an arduino.
Arduino received the signal of the sensor and with ESP it send to the web server.
My problem is the code doesn´t execute automatically and if I run the code from my pc it just run for 8 sec and then stop.

I found some code and i adjusted it to my requeriments.
/////
import time
import uos
from machine import UART
import urequests

import network

uart0 = UART(0)
uart1 = UART(1)
print(uart0)
print(uart1)


from machine import UART
import uos

uos.dupterm(None, 1)
uart = UART(0, 115200,8,None,1)
uart.write(b"The quick brown fox jumps over the lazy dog\r\n")
ch = b""

while True :
if uart.any() :
ch = uart.read()
uart.write(ch)
response = urequests.post("http://192.168.42.94:9997/pruebaPost", data=None,json={'extractor':'on','estufa':'off','HU': "62",'tmp':ch,'co':"1"}, headers={})

uos.dupterm(UART(0, 115200), 1)