Unsure why display won't work with WiPy3.0
I switched recently from pyboard v1.1 to the WiPy. I have a display ST7735 that was working with the pyboard, but have been unable to get it to work with the new WiPy.
I have tried using two different libraries:
(modifying both from "low/high" to "value(0/1)" as needed)
This is my initialization in main:
from machine import SPI, Pin displayres = 'P7' displaydc = 'P8' displaycs = 'P9' displaysck = 'P10' displaymiso = 'P14' displaymosi = 'P11' spi = SPI(0, baudrate=8000000, polarity=0, phase=0) d = ST7735.ST7735(spi, rst=displayres, ce=displaycs, dc=displaydc) d.reset() d.begin() d.fill_screen(0x0000)
It isn't returning any error messages but the display is not responding to anything being sent as it did with my pyboard (running this library which uses pyb instead of machine https://github.com/GuyCarver/MicroPython/blob/master/lib/ST7735.py)
I'm at my wit's end, I can't tell what I'm doing wrong.
I fixed this:
"I ended up adding wifi connect back into boot and lo and behold I now get the error message from the display library issue. So now I have the wifi connect in two places and I can't understand why WiPy is the way it is. I really think this deserves a fix in the firmware to stop blowing away boot."
If you run this once:
it will no longer behave like this.
OK I figured it out, and I'm explaining here just in case anyone else ran into the same error.
I struggled to get the board originally to connect to wifi. It would say it was connected but didn't? It was like boot was being blown away as soon as it was run. So I finally got the wifi working on this board by moving that code into main, I deleted it out of boot because it seemed stupid and redundant.
So boot was empty and main had the wifi connect in it, and everything was fine. HOWEVER, there was an error in the display library with an indentation, and although this killed my program, it still connected successfully to wifi but did not send the indent error to pymakr. So there was an error message not being propagated.
I ended up adding wifi connect back into boot and lo and behold I now get the error message from the display library issue. So now I have the wifi connect in two places and I can't understand why WiPy is the way it is. I really think this deserves a fix in the firmware to stop blowing away boot.
Here's the wifi code just in case someone wants it:
from network import WLAN import machine import pycom #WIFI initialization wlan = WLAN(mode=WLAN.STA) wlan.ifconfig(id=0, config='dhcp') wlan.connect(ssid='Main', auth=(WLAN.WPA2, password), hostname='WiPy-1') while not wlan.isconnected(): machine.idle() print("WiFi connected succesfully") print(wlan.ifconfig()) pycom.heartbeat(False)