Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
combined SPI and WIFI code on nodemcu blocking SPI

Hello,I have built a wifi network which worked fine. then i added SPI commands to transfer data simultaniosly with wifi. if i use spi.write after conn=s.accept() my SPI sends nothing. If i write spi.write before conn=s.accept() it sends SPI sequence as shown in the photo bellow. Why the Socket commands block SPI commands? 


from machine import Pin,SPI
from time import sleep
import network
import usocket as socket
spi = machine.SPI(1, baudrate=1000000, polarity=0, phase=0)
ap_if = network.WLAN(network.AP_IF)
ssid = 'Sensor network4'
password = '123456789'
ap_if.config(essid=ssid, password=password)

while True:
    request='<p style="color:red"><u></u></p><h1><u>The temperature is:</u><p></p>'
    conn.send('HTTP/1.1 200 OK\n')
    conn.send('Content-type: text/html\n')
    conn.send('Connection: close\n\n')


Forum Jump:

Users browsing this thread: 1 Guest(s)