0

Using pin alarms on the Clue
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Using pin alarms on the Clue

by iAmBen on Sat May 21, 2022 10:18 am

Hi all,

I'm trying to create an alarm that will wake my Clue up when one of the buttons is pressed. Here's what's happening:

Adafruit CircuitPython 7.2.3 on 2022-03-16; Adafruit CLUE nRF52840 Express with nRF52840
>>> from adafruit_clue import clue
>>> import board
>>> import alarm
>>> pa = alarm.pin.PinAlarm(pin=board.BUTTON_A, value=False, pull=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: P5 in use

Is it possible to use pin alarms on the Clue? If so would someone mind pointing out what I'm doing wrong?

Cheers.

iAmBen
 
Posts: 2
Joined: Sat May 21, 2022 10:09 am

Re: Using pin alarms on the Clue

by mikeysklar on Sat May 21, 2022 12:13 pm

Your code looks correct.

Does it change things to use:

; left button
Code: Select all | TOGGLE FULL SIZE
pa = alarm.pin.PinAlarm(pin=board.D5, value=False, pull=True)


; right button
Code: Select all | TOGGLE FULL SIZE
pa = alarm.pin.PinAlarm(pin=board.D11, value=False, pull=True)


; right button (builtin name)
Code: Select all | TOGGLE FULL SIZE
pa = alarm.pin.PinAlarm(pin=board.BUTTON_B, value=False, pull=True)


Please verify using CircuitPython 7.2.5, bootloader 0.6.3 and upgrading any libraries that are not builtin from the bundle 20220521.

https://circuitpython.org/board/clue_nrf52840_express/
https://circuitpython.org/libraries

mikeysklar
 
Posts: 7760
Joined: Mon Aug 01, 2016 8:10 pm

Re: Using pin alarms on the Clue

by iAmBen on Mon May 23, 2022 7:37 am

Hi,

Thanks for the tips. Unfortunately I'm still receiving the same error.

Now running:

Bootloader 0.6.4 (clue_nrf52840_bootloader-0.6.4_s140_6.1.1) flashed successfully using adafruit-nrfutil (was previously 0.3.0)
adafruit-circuitpython-clue_nrf52840_express-en_GB-7.2.5
Library bundle adafruit-circuitpython-bundle-7.x-mpy-20220522

Passing the buttons in the different ways you suggested doesn't change the error - I still get P5 for a and P11 for b.
Happy to file an issue if you reckon we're at that point yet?

iAmBen
 
Posts: 2
Joined: Sat May 21, 2022 10:09 am

Re: Using pin alarms on the Clue

by mikeysklar on Mon May 23, 2022 6:19 pm

You are current with reproducible code. This would be a good time to file an issue. Please include the full example code you are using for pinAlarm.

https://github.com/adafruit/Adafruit_Ci ... LUE/issues

mikeysklar
 
Posts: 7760
Joined: Mon Aug 01, 2016 8:10 pm

Re: Using pin alarms on the Clue

by adafruit2 on Mon May 23, 2022 10:15 pm

the adafruit_clue library initializes the pins for you as buttons,
https://github.com/adafruit/Adafruit_Ci ... ue.py#L194
so you'll need to clue._a.deinit() or similar to uncreate that button

adafruit2
Site Admin
 
Posts: 20949
Joined: Fri Mar 11, 2005 7:36 pm

Please be positive and constructive with your questions and comments.