Similar to this recent post, I have written a bit of code which I now want to execute on power up but I am not getting the advertised results. I am using rshell to upload my code to a generic ESP32-S board from Ebay.
Code: Select all
from machine import Pin, SPI
import time
from NuovoLedControl import Nuovo7Segment
#Call constructor with DIN , CS , CLK pin. For initial setup pin
segment = Nuovo7Segment(Pin(2), Pin(5, Pin.OUT), Pin(4))
segment.setBrightness(4)
segment.clearDisplay()
dly = 500
for y in range(0, 8):
segment.setDigit(y, y, True)
time.sleep_ms(2 * dly)
while True:
for y in range(8, 0, -1):
segment.setRow(y-1,0b00000000)
time.sleep_ms(dly)
time.sleep_ms(dly)
for y in range(0, 8):
segment.setRow(y,0b00000001)
time.sleep_ms(dly)
for y in range(0, 8):
segment.setRow(y,0b00001000)
time.sleep_ms(dly)
for y in range(0, 8):
segment.setRow(y,0b01000000)
time.sleep_ms(dly)
x=7
for y in range(0, 8):
segment.setDigit(y, x, True)
x-=1
time.sleep_ms(5 * dly)
x=7
for y in range(0, 8):
segment.setDigit(y, x, False)
time.sleep_ms(dly)
x-=1
# time.sleep_ms(5 * dly)
To get it to execute on power on, I renamed the file itself to be main.py.
I am never seeing it execute at power on and only seldom does it execute at hard reset, however.
It executes automatically just fine at a soft reset but not hard.
As per the above referenced similar post, I have checked my code for mix of spaces and tabs but I saw only tabs. I ran my code through the mill at tabstospaces.com and believe I have a tab free/spaces only version now but no difference in behaviour.
Where am I going wrong, thoughts or advice?
Thanks,
Brian H.