-
Notifications
You must be signed in to change notification settings - Fork 71
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
Looking for more Tricks #17
Comments
Hi! As for how to read battery voltage level on the Feather RP2040, that's pretty particular to that board. You will need to do some wiring as mentioned here in the Learn Guide. And the actual code to use once you have that wired up is, unfortunately, in a guide for one of the other Feathers. To run code from the REPL is really easy. If you have a a file called "mycode.py", you can type Unfortunately, CircuitPython clears all state of running code when you Ctrl-C into the REPL. This is one of the ways it differs from MicroPython. Scott (lead developer of CircuitPython) recently talked about this on the Hackaday livestream I think, and the reasoning was so that users don't get frustrated from the unintended side effects of old variables or unreleased board resources causing errors. (e.g. you would have to make sure to do |
If you want to have a point in your code that pauses until you do some action, you could add an |
The import and execute module code in a function is very handy but if you have to change code you need to restart. I was hoping for a some sort of a REPL software reset (I tried supervisor.reload() ) but does nothing. |
I'm unclear what you're looking for. Can't you Ctrl-C to stop the code, then do "import othercode" to run a different program in Or do you want to do a reset? If you'd like to reset the whole board from the REPL, you can do: import microcontroller; microcontroller.reset() I use this all the time. If you're using a serial terminal that auto-reconnects (like Sometimes I'll also use this trick with a |
I figured out the import, fix code and import again flow :) thanks. I used tio and its really powerful and will use it. Mind telling me which IDE you are using for circuitpython. I am now using Mu but it is limited. |
You can use any text editor, or an IDE like VS Code or PyCharm. Check out tio to run in a terminal to get the serial output if you're using macOS or Linux: https://github.com/tio/tio |
Yep, I just use a standard text editor (Emacs or Sublime Text, depending) to edit my CircuitPython. I didn't grow up using IDEs so I'm not much of a user of them. I know some folks use VSCode to great effect, opening up But my regular workflow is very IDE-like: text editor in one window, a terminal window next to it running |
I've setup with VSCode and the plugin for Circuitpython using tio for terminal. Only problem, cant use code.py as a filename because of conflict with python stdlib, so i changed it to main.py. Works great. |
Please a tutorial with midi timing clock 🙏https://docs.circuitpython.org/projects/midi/en/latest/api.html#adafruit_midi.timing_clock.TimingClock |
CircuitPython isn't really fast enough to handle MIDI clock, but you can see an attempt here: |
Hi, I made the attempt, but the timing isn't calculated correctly. To have my DAW at 120 BPM, I need to set it to 125. Is that what you mean by it being slow? import time, serial, mido
import adafruit_midi
from adafruit_midi import MIDI
from adafruit_midi.timing_clock import TimingClock
uart = serial.Serial(port='/dev/ttyAMA0', baudrate=31250)
midi = MIDI(midi_out= uart, out_channel=12-1, debug=False) #Channel 12
# BPM
bpm = 125 ## time in a any DAW is 120BPM... why??? 🥴
# Calcula el intervalo de tiempo deseado en segundos
intervalo_de_tiempo = 60.0 / bpm / 24
while True:
#print(intervalo_entre_mensajes)
midi.send(TimingClock())
time.sleep(intervalo_de_tiempo ) Thanks |
How to read battery voltage level. I am using an Adafruit RP2040 feather and power it using 3.3V 500mAh rechargeable battery.
How to run code.py from REPL. Just curioys if there some way to execute code.py from REPL
How to break out of code into REPL but retain state of imports and variables. It could be either a hotkey or some bython command, almost like a breakpoint.
Thanks
The text was updated successfully, but these errors were encountered: