Search found 7 matches

by NameOfTheRose
Fri Dec 02, 2022 9:27 am
Forum: Raspberry Pi microcontroller boards
Topic: How to use Low Power Sleep Mode on the PICO? code examples?
Replies: 1
Views: 21444

Re: How to use Low Power Sleep Mode on the PICO? code examples?

Sorry for the delayed response, you might have already found the answer to your question. The latest micropython releases provide a lightsleep function in the machine module that does that. I have tested on a rpi pico with rp2-pico-20221128-unstable-v1.19.1-721-gd5181034f.uf2 (The latest stable vers...
by NameOfTheRose
Tue May 24, 2022 5:34 am
Forum: Raspberry Pi microcontroller boards
Topic: rpi pico: How to detect that sys.stdout is connected
Replies: 3
Views: 3795

Re: rpi pico: How to detect that sys.stdout is connected

THANK YOU!!!! This was driving me nuts! Having a data-logger capture data (ex: temperature) and not erase the file was proving difficult. Even in the official PICO Handbook which works great when connected to a computer, but won't work as a headless data logger. Did a few tests, and the code works ...
by NameOfTheRose
Fri Oct 22, 2021 1:00 pm
Forum: Raspberry Pi microcontroller boards
Topic: How to Send/Receive via Pico USB
Replies: 2
Views: 3252

Re: How to Send/Receive via Pico USB

so far i only found this way: import sys, select mystring = sys.stdin.buffer.read() #code to modify the string select.select([sys.stdout],[],[],0)[0] sys.stdout.write(modifiedstring) will the REPL interfere with this? Is it possible to use other interface like the usb_cdc.data in circuitpython? Yes...
by NameOfTheRose
Sat Sep 11, 2021 12:19 pm
Forum: Raspberry Pi microcontroller boards
Topic: USB VBUS detection
Replies: 5
Views: 4743

Re: USB VBUS detection

On page 18, §4.4. Powerchain of the pico datasheet it is mentioned: «GPIO24 monitors the existence of VBUS, while R10 and R1 act to pull VBUS down to make sure it is 0V if VBUS is not present.» referring to figure 14 on the same page. So if you just want to know wheteher power is actully coming from...
by NameOfTheRose
Wed Jul 14, 2021 9:07 am
Forum: Raspberry Pi microcontroller boards
Topic: rpi pico: How to detect that sys.stdout is connected
Replies: 3
Views: 3795

Re: rpi pico: How to detect that sys.stdout is connected

Being unable to find a solution in the micropython realm, I resorted to the hardware: rp2040 usb peripheral has a status register called SIE_STATUS. Bits 16 and 4 show the CONNECTED and SUSPENDED status. If CONNECTED ==1 and SUSPENDED ==0, the interface is active and writing to it will not block. SI...
by NameOfTheRose
Mon Jul 12, 2021 5:23 pm
Forum: Raspberry Pi microcontroller boards
Topic: rpi pico: How to detect that sys.stdout is connected
Replies: 3
Views: 3795

rpi pico: How to detect that sys.stdout is connected

How can one detect if the usb serial is actually connected to the host pc? I have tried uselect.poll and test for uselect.POLLHUP and uselect.POLLERR without success,poll(0) always returns []. But if the pc goes to sleep, print() blocks. It unblocks by itself when the pc wakes up. Thank you. PS. I h...
by NameOfTheRose
Tue Jun 29, 2021 7:27 am
Forum: General Discussion and Questions
Topic: _thread.interrupt_main()
Replies: 0
Views: 841

_thread.interrupt_main()

Are there plans to implement the _thread.interrupt_main() as described in _thread — Low-level threading API?
My idea is to use that feature to implement a time out on blocking code.
Thank you.