Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Use CTRL-D programmatically
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Use CTRL-D programmatically

by john_doe1337 on Fri Sep 04, 2020 8:09 am

Hello,
is it possible to use the CTRL-D (Use CTRL-D to reload) programmatically.

So for example, instead of raising an Error reload the programm?

john_doe1337
 
Posts: 3
Joined: Mon Mar 23, 2020 8:51 am

Re: Use CTRL-D programmatically

by danhalbert on Fri Sep 04, 2020 8:33 am

You can call `supervisor.reload()`, which is equivalent to typing ctrl-D: https://circuitpython.readthedocs.io/en ... sor.reload

danhalbert
 
Posts: 2118
Joined: Tue Aug 08, 2017 12:37 pm

Re: Use CTRL-D programmatically

by kevinjwalters on Fri Sep 25, 2020 1:49 pm

What's the intended behavour of supervisor.reload() in REPL? It doesn't appear to do anything immediately visible based on the prompt. The pwm output continues afterwards uninterrupted too.

Code: Select all | TOGGLE FULL SIZE
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit CLUE nRF52840 Express with nRF52840
>>> import board
>>> import pulseio
>>> pwm_p2=pulseio.PWMOut(board.P2, duty_cycle=32768)
>>> import supervisor
>>> supervisor.reload()

kevinjwalters
 
Posts: 740
Joined: Sun Oct 01, 2017 3:15 pm

Re: Use CTRL-D programmatically

by tannewt on Fri Sep 25, 2020 1:58 pm

I suppose it should exit the REPL. I don't know why you'd use it over ctrl-d though. I believe you can also type `exit` or `quit` too.

tannewt
 
Posts: 1789
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.