Hello,
My QT Py 'forgets' CircuitPython 6.2.0 and/or 7.0.0 if I remove power for more than a few seconds. When I then reload CP 6.2.0 or 7.0.0, after the Boot Button process, everything works fine until the next time I have to remove power. I have tried flash_nuke.uf2, and no change. Different USB ports and different cables, no change. When I do the Boot Button process I see the standard INDEX.HTM and INFO_UF2.TXT. I then copy CircuitPython 6 or 7 to the QT Py and away we go. The reset button by itself does not bring back CircuitPython. The only components external to the QT Py RP2040 is a 1k Ohm resistor and an LED on the TX pin. Removing them does not change things. This has me stumped. Thanks for your help.
Bruce
QT Py RP2040 forgets CircuitPython
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- kattni
- Posts: 132
- Joined: Fri Aug 18, 2017 6:33 pm
Re: QT Py RP2040 forgets CircuitPython
Hello,
To be clear, when you go through the boot select/reset button sequence, you see the RPI-RP2 drive, correct? Then, after you copy the adafruit-circuitpython-adafruit_qtpy_rp2040-en_US-6.2.0.uf2 (or 7.0.0) file to the RPI-RP2 drive, you see a CIRCUITPY drive?
Then you remove power or a period of time, and what happens when you plug it back in?
To be clear, when you go through the boot select/reset button sequence, you see the RPI-RP2 drive, correct? Then, after you copy the adafruit-circuitpython-adafruit_qtpy_rp2040-en_US-6.2.0.uf2 (or 7.0.0) file to the RPI-RP2 drive, you see a CIRCUITPY drive?
Then you remove power or a period of time, and what happens when you plug it back in?
- blakebr
- Posts: 942
- Joined: Tue Apr 17, 2012 6:23 pm
Re: QT Py RP2040 forgets CircuitPython
Kattni,
Yes, With Boot pressed I see the 'RPI-RP2' drive, after I copy 6.2.0 or 7.0.0 I see the 'CIRCUITPY' drive.
When I remove power for a minute or so and reconnect, 'Nothing' happens. Silence, crickets...
On my Windows 10 machine a USB port is not triggered that there is anything on the port. 'Control Panel >> Device Manager >> Ports (COM & LPT)' Does not show the device.
After loading 'adafruit-circuitpython-adafruit_qtpy_rp2040-en_US-6.2.0.uf2' it shows up as COM16.
If I copy the exact same 'code.py' to an ItsyBitsy RP2040 the problem does not appear.
The ItsyBitsy has 'adafruit-circuitpython-adafruit_itsybitsy_rp2040-en_US-6.2.0.uf2' loaded. The Red LED pin is changed from TX on the QT Py to D13 on the ItsyBitsy.
Do I get a Black Star and get sent to sit in the corner for breaking the QT Py? ;-) Thanks for your help.
Bruce
Yes, With Boot pressed I see the 'RPI-RP2' drive, after I copy 6.2.0 or 7.0.0 I see the 'CIRCUITPY' drive.
When I remove power for a minute or so and reconnect, 'Nothing' happens. Silence, crickets...
On my Windows 10 machine a USB port is not triggered that there is anything on the port. 'Control Panel >> Device Manager >> Ports (COM & LPT)' Does not show the device.
After loading 'adafruit-circuitpython-adafruit_qtpy_rp2040-en_US-6.2.0.uf2' it shows up as COM16.
If I copy the exact same 'code.py' to an ItsyBitsy RP2040 the problem does not appear.
The ItsyBitsy has 'adafruit-circuitpython-adafruit_itsybitsy_rp2040-en_US-6.2.0.uf2' loaded. The Red LED pin is changed from TX on the QT Py to D13 on the ItsyBitsy.
Do I get a Black Star and get sent to sit in the corner for breaking the QT Py? ;-) Thanks for your help.
Bruce
- blakebr
- Posts: 942
- Joined: Tue Apr 17, 2012 6:23 pm
Re: QT Py RP2040 forgets CircuitPython
Kattni,
If you have the time there is an issue with the NeoPixel RGB sequence.
neopixel.RGB gives different results if you are referencing board.NEOPIXEL or board.EXTERNAL_PIN
board.NEOPIXEL has the first two colors reversed. To get an RGB result for board.NEOPIXEL I must specify GRB.
If I specify NUM_PIXELS as '1' I reference the onboard NeoPixel, otherwise the NeoPixel string on the board..SDA pin.
I have not tested this on other versions of CircuitPython.
if(NUM_PIXELS == 1): # NEOPIXEL Internal NeoPixel
STRING = board.NEOPIXEL #
ORDER = neopixel.GRB # Neo_1=Green, Neo_2=Red, Neo_3=Blue R&G reversed
BRIGHTNESS = 0.10 #
Neo_1_Max = 150 # Green
Neo_2_Max = 50 # Red
Neo_3_Max = 250 # Blue
else: # SDA External NeoPixel(s)
STRING = board.SDA #
ORDER = neopixel.RGB # Neo_1=Red, Neo_2=Green, Neo_3=Blue R&G normal
BRIGHTNESS = 0.25 #
Neo_1_Max = 250 # Red
Neo_2_Max = 250 # Green
Neo_3_Max = 250 # Blue
Bruce
If you have the time there is an issue with the NeoPixel RGB sequence.
neopixel.RGB gives different results if you are referencing board.NEOPIXEL or board.EXTERNAL_PIN
board.NEOPIXEL has the first two colors reversed. To get an RGB result for board.NEOPIXEL I must specify GRB.
If I specify NUM_PIXELS as '1' I reference the onboard NeoPixel, otherwise the NeoPixel string on the board..SDA pin.
I have not tested this on other versions of CircuitPython.
if(NUM_PIXELS == 1): # NEOPIXEL Internal NeoPixel
STRING = board.NEOPIXEL #
ORDER = neopixel.GRB # Neo_1=Green, Neo_2=Red, Neo_3=Blue R&G reversed
BRIGHTNESS = 0.10 #
Neo_1_Max = 150 # Green
Neo_2_Max = 50 # Red
Neo_3_Max = 250 # Blue
else: # SDA External NeoPixel(s)
STRING = board.SDA #
ORDER = neopixel.RGB # Neo_1=Red, Neo_2=Green, Neo_3=Blue R&G normal
BRIGHTNESS = 0.25 #
Neo_1_Max = 250 # Red
Neo_2_Max = 250 # Green
Neo_3_Max = 250 # Blue
Bruce
- kattni
- Posts: 132
- Joined: Fri Aug 18, 2017 6:33 pm
Re: QT Py RP2040 forgets CircuitPython
Only Adafruit stars here. :)
(Regarding the NeoPixel thing, please create a new forum post. Best to keep these single-topic.)
I have couple of questions.
Are the files in CIRCUITPY gone after the reload of the UF2, or are they still there?
Please complete the following process to eliminate a possible issue with the filesystem contents.
What I would like you to do is WITHOUT unplugging it at any point during the initial part of this process: get CircuitPython loaded. Then please connect to the serial console and enter the REPL. (https://learn.adafruit.com/welcome-to-c ... al-console is available if you don't know this process.)
Once at the >>> REPL prompt, run the following commands:
CIRCUITPY will eject, and then remount.
Now, unplug it for the requisite amount of time, and plug it back in. Does it still fail to come back up?
~Kattni
(Regarding the NeoPixel thing, please create a new forum post. Best to keep these single-topic.)
I have couple of questions.
Are the files in CIRCUITPY gone after the reload of the UF2, or are they still there?
Please complete the following process to eliminate a possible issue with the filesystem contents.
What I would like you to do is WITHOUT unplugging it at any point during the initial part of this process: get CircuitPython loaded. Then please connect to the serial console and enter the REPL. (https://learn.adafruit.com/welcome-to-c ... al-console is available if you don't know this process.)
Once at the >>> REPL prompt, run the following commands:
Code: Select all
import storage
storage.erase_filesystem()
Now, unplug it for the requisite amount of time, and plug it back in. Does it still fail to come back up?
~Kattni
- blakebr
- Posts: 942
- Joined: Tue Apr 17, 2012 6:23 pm
Re: QT Py RP2040 forgets CircuitPython
Kattni,
The files are NOT gone after I reload the .uf2. Everything is still there.
I followed your directions to erase the file system.
When it came back up the LED was flashing GREEN.
When I unplug, wait, plug it back in - Nothing happens.
Boot Button and reload CircuitPython, Reboot happens, All my code is gone, Factory fresh files.
code.py has 'Hello' World code in it.
Reload the lib subdirectory and add my code.py file and my code runs fine.
I noticed this morning that the issue also happens when I push the reset button.
Bruce
The files are NOT gone after I reload the .uf2. Everything is still there.
I followed your directions to erase the file system.
When it came back up the LED was flashing GREEN.
When I unplug, wait, plug it back in - Nothing happens.
Boot Button and reload CircuitPython, Reboot happens, All my code is gone, Factory fresh files.
code.py has 'Hello' World code in it.
Reload the lib subdirectory and add my code.py file and my code runs fine.
I noticed this morning that the issue also happens when I push the reset button.
Bruce
- kattni
- Posts: 132
- Joined: Fri Aug 18, 2017 6:33 pm
Re: QT Py RP2040 forgets CircuitPython
This is incredibly odd. Do you have another machine, a Mac or a Raspberry Pi for example, that you could try the board on?
- blakebr
- Posts: 942
- Joined: Tue Apr 17, 2012 6:23 pm
Re: QT Py RP2040 forgets CircuitPython
Kattni,
100% failure in:
Apple charger, Samsung charger, Qualcomm 3.0 quick charger, HP printer, Dell printer, Raspberry Pi 3B+, Raspberry Pi 4B, 2 ports on first Windows 10 machine, 3 ports on second Windows 10 machine, TP-Link HS100v2.
Bruce
100% failure in:
Apple charger, Samsung charger, Qualcomm 3.0 quick charger, HP printer, Dell printer, Raspberry Pi 3B+, Raspberry Pi 4B, 2 ports on first Windows 10 machine, 3 ports on second Windows 10 machine, TP-Link HS100v2.
Bruce
- kattni
- Posts: 132
- Joined: Fri Aug 18, 2017 6:33 pm
Re: QT Py RP2040 forgets CircuitPython
Thank you for troubleshooting with me. Please email [email protected] with a link to this thread, and let them know I've approved a replacement QT Py RP2040 for you. They'll take it from here.
Best guess it's something wonky with the flash, but it still isn't acting entirely like that's the case either. You found an odd one!
~Kattni
Best guess it's something wonky with the flash, but it still isn't acting entirely like that's the case either. You found an odd one!
~Kattni
- blakebr
- Posts: 942
- Joined: Tue Apr 17, 2012 6:23 pm
Re: QT Py RP2040 forgets CircuitPython
Kattni,
I am good at finding wonky/odd things. I carry that title with a badge of pride.
Thank you very much for all your time, skills, and knowledge.
Bruce
I've got a joke about Schrodinger's Cat...
Oh wait, no I haven't...
Yes I have!
No I haven't...
(This only becomes a joke when people laugh at it.)
- - - Jay Handley
I am good at finding wonky/odd things. I carry that title with a badge of pride.
Thank you very much for all your time, skills, and knowledge.
Bruce
I've got a joke about Schrodinger's Cat...
Oh wait, no I haven't...
Yes I have!
No I haven't...
(This only becomes a joke when people laugh at it.)
- - - Jay Handley
- blakebr
- Posts: 942
- Joined: Tue Apr 17, 2012 6:23 pm
Re: QT Py RP2040 forgets CircuitPython
Kattni,
The replacement QT Py rp2040 arrived. It does the same thing. Does not start every time power is applied. I have to push the reset button up to a dozen or more times to get the first green LED light. I am running the "Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit QTPy RP2040 with rp2040" OS. If you would like a copy of the code, tell me how to get it to you.
The code does not have any problems running in an ItsyBitsy RP2040 with its OS. Which is strange because the QT Py looks to me to be a folded two sided version of the ItsyBitsy.
Bruce.
The replacement QT Py rp2040 arrived. It does the same thing. Does not start every time power is applied. I have to push the reset button up to a dozen or more times to get the first green LED light. I am running the "Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit QTPy RP2040 with rp2040" OS. If you would like a copy of the code, tell me how to get it to you.
The code does not have any problems running in an ItsyBitsy RP2040 with its OS. Which is strange because the QT Py looks to me to be a folded two sided version of the ItsyBitsy.
Bruce.
- kattni
- Posts: 132
- Joined: Fri Aug 18, 2017 6:33 pm
Re: QT Py RP2040 forgets CircuitPython
Please post your code here inside the
Code: Select all
tags. I'll see if I can replicate the issue.
- blakebr
- Posts: 942
- Joined: Tue Apr 17, 2012 6:23 pm
Re: QT Py RP2040 forgets CircuitPython
Code: Select all
#
# ********** QT Py RP2040 **********
# adafruit-circuitpython-adafruit_qtpy_rp2040-en_US-6.2.0.uf2
# Internal Library
import os
import rtc
import time
import board
import busio
import random
#import AT24C32
import digitalio
from digitalio import DigitalInOut, Direction, Pull
import microcontroller
from microcontroller import pin
# External Library( /lib/ )
import neopixel
import adafruit_ds3231
import adafruit_ds18x20
from adafruit_onewire.bus import OneWireBus
from adafruit_ds18x20 import DS18X20
import displayio
import terminalio
from adafruit_display_text import label
import adafruit_displayio_ssd1306
########################################
# Factory Reset: #
# import storage #
# storage.erase_filesystem() #
########################################
print("Program START! QT Py RP2040")
#print(microcontroller.11)
print(" os.name: ", end="")
print(os.uname)
print(" cpus[0].temperature: ", end="")
print(microcontroller.cpus[0].temperature)
print(" cpus[0].frequency: ", end="")
print(microcontroller.cpus[0].frequency)
print(" cpus[1].temperature: ", end="")
print(microcontroller.cpus[1].temperature)
print(" cpus[1].frequency: ", end="")
print(microcontroller.cpus[1].frequency)
print(" cpu.id: ", end="")
print(microcontroller.cpu.uid)
print(" cpu.voltage: ", end="")
print(microcontroller.cpu.voltage)
print("")
time.sleep(1) # Show GREEN LED if we are good
EEPROM = 0x57
OLED = 0x3C
i2c = board.I2C()
#i2c1 = busio.I2C(board.SCL1, board.SDA1) # SCL1=D23, SDA1=D22
#while not i2c1.try_lock():
# time.sleep(0.001)
#print(i2c1.scan())
#display_bus = displayio.I2CDisplay(i2c, device_address=0x3c)
#display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)
#displayio.release_displays()
time.sleep(2)
DS_Clock = adafruit_ds3231.DS3231(i2c) # DS3231 RTC Clock 0-6 Sun-Sat
SYS_Clock = rtc.RTC() # Local CPU System Clock 0-6 Mon-Sun
ow_bus = OneWireBus(board.SCK)
ds18 = DS18X20(ow_bus, ow_bus.scan()[0])
DoW = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
months = ("Null", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
if False: # If 'True' set the DS3231 RTC
#struct_time(tm_year=2021, tm_mon=4, tm_mday=25, tm_hour=14, tm_min=8, tm_sec=16, tm_wday=5, tm_yday=116, tm_isdst=-1)
time_year =2021
time_mon =5
time_mday =3
time_hour =12
time_min =55
time_sec =0
time_wday =1 # calculated not setable on system/CPU time DS3231 0 - 6 Sun-Sat
time_yday =123 # calculated not setable on system/CPU time System 0 - 6 Mon-Sun
time_isdst=1 # calculated not setable on system/CPU time
print("Time set to: ", temp)
temp = time.struct_time((time_year, time_mon, time_mday, time_hour, time_min, time_sec, time_wday, time_yday, time_isdst))
DS_Clock.datetime = temp
print("")
time.sleep(1)
temp = DS_Clock.datetime[5] # Get full DTG Tuple, [5] is seconds
while(temp == DS_Clock.datetime[5]): # wait for next second
time.sleep(0.01) # wait 10ms for next time check
time.sleep(0.25)
SYS_Clock.datetime = DS_Clock.datetime # Set the system clock to the RTC DS3231 clock
current_time = SYS_Clock.datetime
temp = current_time
print(DS_Clock.datetime)
print(SYS_Clock.datetime)
print(str(current_time[0])+"/"+ str(current_time[1])+"/"+ str(current_time[2])+" "+ str(current_time[3])+"/"+ str(current_time[4])+"/"+ str(current_time[5])+" "+ DoW[current_time[6]+1]+" DoY "+ str(current_time[7])+" DST "+ str(current_time[8]))
time.sleep(1)
print(microcontroller.cpus[0].temperature, microcontroller.cpus[0].temperature*1.8+32)
print(microcontroller.cpus[1].temperature, microcontroller.cpus[1].temperature*1.8+32)
global OldRed
global OldGreen
global OldBlue
OldRed = 0
OldGreen = 0
OldBlue = 0
x = 0
NUM_PIXELS = 1 # if =1 use onboard NeoPixel
if(NUM_PIXELS == 1): # NEOPIXEL Internal NeoPixel
STRING = board.NEOPIXEL #
ORDER = neopixel.GRB # Neo_1=Green, Neo_2=Red, Neo_3=Blue R&G reversed
BRIGHTNESS = 0.10 #
Neo_1_Max = 150 # Green
Neo_2_Max = 50 # Red
Neo_3_Max = 250 # Blue
else: # RX External NeoPixel(s)
STRING = board.RX #
ORDER = neopixel.RGB # Neo_1=Red, Neo_2=Green, Neo_3=Blue R&G normal
BRIGHTNESS = 0.25 #
Neo_1_Max = 250 # Red
Neo_2_Max = 250 # Green
Neo_3_Max = 250 # Blue
print(STRING, NUM_PIXELS, ORDER)
# pixelString = neopixel.NeoPixel(board.NEOPIXEL, NUM_PIXELS, bpp=3, brightness=BRIGHTNESS, auto_write=True, pixel_order=ORDER)
pixelString = neopixel.NeoPixel(STRING, NUM_PIXELS, bpp=3, brightness=BRIGHTNESS, auto_write=False, pixel_order=ORDER)
RED_led = DigitalInOut(board.TX)
RED_led.direction = Direction.OUTPUT
RED_led.value = False
print(microcontroller.pin.GPIO11)
#################################################
def scan_GPIO():
GPIO_A0 = digitalio.DigitalInOut(board.A0)
GPIO_A0.direction = digitalio.Direction.INPUT
print("GPIO_A0 = ", end="")
print(GPIO_A0.value)
GPIO_A1 = digitalio.DigitalInOut(board.A1)
GPIO_A1.direction = digitalio.Direction.INPUT
print("GPIO_A1 = ", end="")
print(GPIO_A1.value)
GPIO_A2 = digitalio.DigitalInOut(board.A2)
GPIO_A2.direction = digitalio.Direction.INPUT
print("GPIO_A2 = ", end="")
print(GPIO_A2.value)
GPIO_A3 = digitalio.DigitalInOut(board.A3)
GPIO_A3.direction = digitalio.Direction.INPUT
print("GPIO_A3 = ", end="")
print(GPIO_A3.value)
GPIO_D4 = digitalio.DigitalInOut(board.D4)
GPIO_D4.direction = digitalio.Direction.INPUT
print("GPIO_D4 = ", end="")
print(GPIO_D4.value)
GPIO_D5 = digitalio.DigitalInOut(board.D5)
GPIO_D5.direction = digitalio.Direction.INPUT
print("GPIO_D5 = ", end="")
print(GPIO_D5.value)
# GPIO_D6 = digitalio.DigitalInOut(board.D^)
# GPIO_D6.direction = digitalio.Direction.INPUT
print("GPIO_D6 = ", end="")
print(RED_led.value)
GPIO_D7 = digitalio.DigitalInOut(board.D7)
GPIO_D7.direction = digitalio.Direction.INPUT
print("GPIO_D7 = ", end="")
print(GPIO_D7.value)
GPIO_D8 = digitalio.DigitalInOut(board.D8)
GPIO_D8.direction = digitalio.Direction.INPUT
print("GPIO_D8 = ", end="")
print(GPIO_D8.value)
GPIO_D9 = digitalio.DigitalInOut(board.D9)
GPIO_D9.direction = digitalio.Direction.INPUT
print("GPIO_D9 = ", end="")
print(GPIO_D9.value)
GPIO_D10 = digitalio.DigitalInOut(board.D10)
GPIO_D10.direction = digitalio.Direction.INPUT
print("GPIO_D10 = ", end="")
print(GPIO_D10.value)
# GPIO_D11 = digitalio.DigitalInOut(board.NEOPIXEL_POWER)
# GPIO_D11.direction = digitalio.Direction.INPUT
# print("NEOPIXEL_POWER = ", end="")
# print(NEOPIXEL_POWER.value)
# GPIO_D12 = digitalio.DigitalInOut(board.NEOPIXEL)
# GPIO_D12.direction = digitalio.Direction.INPUT
# print("NEOPIXEL = ", end="")
# print(NEOPIXEL.value)
# GPIO23 board.SCL1
GPIO_D12 = digitalio.DigitalInOut(board.SCL1)
GPIO_D12.direction = digitalio.Direction.INPUT
print("SCL1 = ", end="")
print(GPIO_D12.value)
# GPIO22 board.SDA1
GPIO_D13 = digitalio.DigitalInOut(board.SDA1)
GPIO_D13.direction = digitalio.Direction.INPUT
print("SDA1 = ", end="")
print(GPIO_D13.value)
# GPIO25 board.SCL
# GPIO_D25 = digitalio.DigitalInOut(board.SCL)
# GPIO_D25.direction = digitalio.Direction.INPUT
# print("SCL = ", end="")
# print(GPIO_D25.value)
# GPIO24 board.SDA
# GPIO_D24 = digitalio.DigitalInOut(board.SDA)
# GPIO_D24.direction = digitalio.Direction.INPUT
# print("SDA = ", end="")
# print(GPIO_D24.value)
#################################################
def sequence():
print("")
time.sleep(5)
pixelString.fill((Neo_1_Max, 0, 0))
pixelString.show()
print("Red")
time.sleep(5)
pixelString.fill((0, Neo_2_Max, 0))
pixelString.show()
print("Green")
time.sleep(5)
pixelString.fill((0, 0, Neo_3_Max))
pixelString.show()
print("Blue")
time.sleep(5)
pixelString.fill((0, Neo_2_Max, Neo_3_Max))
pixelString.show()
print("Green + Blue")
time.sleep(5)
pixelString.fill((Neo_1_Max, 0, Neo_3_Max))
pixelString.show()
print("Red + Blue")
time.sleep(5)
pixelString.fill((Neo_1_Max, Neo_2_Max, 0))
pixelString.show()
print("Red + Green")
time.sleep(5)
pixelString.fill((Neo_1_Max, Neo_2_Max, Neo_3_Max))
pixelString.show()
print("Red + Green + Blue")
time.sleep(5)
pixelString.fill((0,0,0))
pixelString.show()
print("All Off")
time.sleep(5)
#################################################
def port_info():
board_pins = []
for pin in dir(microcontroller.pin):
if isinstance(getattr(microcontroller.pin, pin), microcontroller.Pin):
pins = []
for alias in dir(board):
if getattr(board, alias) is getattr(microcontroller.pin, pin):
pins.append("board.{}".format(alias))
if len(pins) > 0:
board_pins.append(" ".join(pins))
for pins in sorted(board_pins):
print(pins)
#################################################
def fillStringRandom(NewRed, NewGreen, NewBlue):
# NewRed = random.randint(0, 255)
# NewGreen = random.randint(0, 255)
# NewBlue = random.randint(0, 255)
for x in range(NUM_PIXELS):
pixelString[x] = ((NewRed, NewGreen, NewBlue))
pixelString.show()
RED_led.value = not RED_led.value
#################################################
def fadeRandomColors(NewRed, NewGreen, NewBlue):
global OldRed
global OldGreen
global OldBlue
# print(OldRed, OldGreen, OldBlue)
# print(NewRed, NewGreen, NewBlue)
while True:
delta = 0
if(NewRed != OldRed):
delta = NewRed - OldRed
delta = delta/(abs(delta))
OldRed = OldRed + delta
if(NewGreen != OldGreen):
delta = NewGreen - OldGreen
delta = delta/(abs(delta))
OldGreen = OldGreen + delta
if(NewBlue != OldBlue):
delta = NewBlue - OldBlue
delta = delta/(abs(delta))
OldBlue = OldBlue + delta
pixelString[x] = ((OldRed, OldGreen, OldBlue))
pixelString.show()
time.sleep(0.001)
if(delta == 0):
break
OldRed = NewRed
OldGreen = NewGreen
OldBlue = NewBlue
RED_led.value = not RED_led.value
return(OldRed, OldGreen, OldBlue)
#################################################
def setSystemClock(): # sets System clock to DS3231 time
temp = DS_Clock.datetime[5]
while(temp == DS_Clock.datetime[5]): # wait for next second
time.sleep(0.01) # wait 10ms for next time check
time.sleep(0.25)
SYS_Clock.datetime = DS_Clock.datetime # Set system clock to RTC DS3231 clock
print("***System clock set to RTC DS3231 clock***")
#################################################
if False:
scan_GPIO()
#################################################
if False:
sequence()
#################################################
if False:
port_info()
#################################################
if True:
print("Random colors")
while True:
# Jj = time.monotonic() #######
while(temp == current_time[5]): # wait for next second
current_time = SYS_Clock.datetime # System DTG
time.sleep(0.001) # wait 1ms for next time check
temp = current_time[5]
# print(time.monotonic() - Jj) #######
# Jj = time.monotonic() #######
DS18 = ds18.temperature
# print(time.monotonic() - Jj) #######
# Jj = time.monotonic() #######
print("DS18B20 Temperature: {:02.6}*C\t{:02.6}*F".format(DS18, DS18*1.8+32))
DS_Clock_Temp = DS_Clock.temperature
print(" DS3231 Temperature: {:02.6}*C\t{:02.6}*F".format(DS_Clock_Temp, DS_Clock_Temp*1.8+32))
CPU_Temp = microcontroller.cpus[0].temperature
print(" CPU0 Temperature: {:02.6}*C\t{:02.6}*F".format(CPU_Temp, CPU_Temp*1.8+32))
CPU_Temp = microcontroller.cpus[1].temperature
print(" CPU1 Temperature: {:02.6}*C\t{:02.6}*F".format(CPU_Temp, CPU_Temp*1.8+32))
NewRed = random.randint(0, 255)
NewGreen = random.randint(0, 255)
NewBlue = random.randint(0, 255)
if(NUM_PIXELS == 1):
fadeRandomColors(NewRed, NewGreen, NewBlue)
else:
time.sleep(0.2)
fillStringRandom(NewRed, NewGreen, NewBlue)
# fillStringRandom(NewRed, NewGreen, NewBlue)
t1 = SYS_Clock.datetime
t2 = DS_Clock.datetime
print("System DTG: {}, {} {}, {} at {}:{:02}:{:02} ".format(DoW[int(t1.tm_wday)+1], months[int(t1.tm_mon)], t1.tm_mday, t1.tm_year, t1.tm_hour, t1.tm_min, t1.tm_sec))
print("DS3231 DTG: {}, {} {}, {} at {}:{:02}:{:02} ".format(DoW[int(t2.tm_wday)], months[int(t2.tm_mon)], t2.tm_mday, t2.tm_year, t2.tm_hour, t2.tm_min, t2.tm_sec))
print("System Day: ", end="")
print(t1.tm_wday)
print("DS3231 Day: ", end="")
print(t2.tm_wday)
print("")
# print(time.monotonic() - Jj) #######
if ((t2.tm_min == 0) and (t2.tm_sec == 0) and (t1.tm_sec != t2.tm_sec )):
setSystemClock() # set System clock to DS3231 time
NewRed = random.randint(0, 255)
NewGreen = random.randint(0, 255)
NewBlue = random.randint(0, 255)
if(NUM_PIXELS == 1):
fadeRandomColors(NewRed, NewGreen, NewBlue)
else:
time.sleep(0.2)
fillStringRandom(NewRed, NewGreen, NewBlue)
# While End
#################################################
print("The End")
#################################################
- blakebr
- Posts: 942
- Joined: Tue Apr 17, 2012 6:23 pm
Re: QT Py RP2040 forgets CircuitPython
Kattni,
If you would like a ZIP of all the files on the QT Py, I can do that.
If you would like a ZIP of all the files on the QT Py, I can do that.
- kattni
- Posts: 132
- Joined: Fri Aug 18, 2017 6:33 pm
Re: QT Py RP2040 forgets CircuitPython
I don't have all the hardware to test this. I am able to get it running, but it quickly complains about a lack of anything on I2C. It comes up immediately though, and repeatedly on reload. Which means, so far, I'm not able to replicate your issue.
Can you distill it down to a minimum viable reproducible example? Is the issue still present with a super simple code.py?
Can you distill it down to a minimum viable reproducible example? Is the issue still present with a super simple code.py?
Please be positive and constructive with your questions and comments.