Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ItsyBitsy M4 Express Deep Sleep with External Wake #7901

Closed
jdswope opened this issue Apr 23, 2023 · 1 comment
Closed

ItsyBitsy M4 Express Deep Sleep with External Wake #7901

jdswope opened this issue Apr 23, 2023 · 1 comment
Labels

Comments

@jdswope
Copy link

jdswope commented Apr 23, 2023

CircuitPython version

Adafruit CircuitPython 8.0.5; 04/23/2032 ItsyBitsy M4 Express

Code/REPL

import gc
import board
import adafruit_ssd1306
import adafruit_tca9548a
import alarm
import time
import digitalio

gc.collect()  # Garbage Collector to free up residual space

# Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(board.I2C())

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT

led.value = True
time.sleep(1)
# led.value = False  No need to turn LED off, deep sleep will do it.

# For each sensor, create it using the TCA9548A channel instead of the I2C object
oled1 = adafruit_ssd1306.SSD1306_I2C(128, 64, tca[2])
oled2 = adafruit_ssd1306.SSD1306_I2C(128, 64, tca[3])
oled3 = adafruit_ssd1306.SSD1306_I2C(128, 64, tca[4])

# After initial setup, can just use sensors as normal.
oled1.fill(0)
oled1.text('Hello There', 0, 0, 1)
oled1.text('World', 0, 10, 1)
oled1.show()

oled2.fill(0)
oled2.text('Hi There!', 0, 0, 1)
oled2.text('How is the world?', 0, 10, 1)
oled2.show()

oled3.fill(0)
oled3.text('Hey!', 0, 0, 1)
oled3.text('What in the World?', 0, 10, 1)
oled3.show()

# Create a an alarm that will trigger 20 seconds from now.
#time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 20)
# digitalio.DigitalInOut(board.D11).deinit()
pin_alarm = alarm.pin.PinAlarm(pin=board.D11, value=False, pull=True)
# Exit the program, and then deep sleep until the alarm wakes us.
#alarm.exit_and_deep_sleep_until_alarms(time_alarm)
# Does not return, so we never get here.

# Exit the program, and then deep sleep until the alarm wakes us.
alarm.exit_and_deep_sleep_until_alarms(pin_alarm)

# Does not return, so we never get here.

Behavior

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 51, in
ValueError: Invalid pin

Red led Blinks twice every 5 seconds or so

Description

Works well when I use the time_alarm and will even accept me setting pin_alarm to D11 but errors out on the wake statement for pin_alatm

Additional information

No response

@jdswope jdswope added the bug label Apr 23, 2023
@jdswope
Copy link
Author

jdswope commented Apr 23, 2023

Sorry: 4/23/2023, not the future! :-). Also, I have tried just about every other pin with the sane results

@jdswope jdswope closed this as completed Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant