Search found 3601 matches

by dhylands
Tue Mar 09, 2021 1:17 am
Forum: MicroPython pyboard
Topic: reassign i2c pins
Replies: 1
Views: 25

Re: reassign i2c pins

On the 405 the pin assignments are hard-wired, so rather than selecting them when you create the I2C object, you reconfigure the approriate pins instead. Rather, you'd do something like this: i2c = pyb.I2C(1,115200) # SCL is now on B6 # SDA is now on B7 # Switch B6/B7 back to GPIO inputs b6 = pyb.Pi...
by dhylands
Mon Mar 08, 2021 3:08 pm
Forum: General Discussion and Questions
Topic: Size of git repository
Replies: 8
Views: 185

Re: Size of git repository

Yo
bobo wrote:
Mon Mar 08, 2021 2:28 pm
its funny comment, but i cant find a way to add post to this forum.

how can i do it?
you go to the area of the forum that you’d like to post (where you see a list of the posts) and click on the “New Topic” button.
by dhylands
Fri Mar 05, 2021 8:17 pm
Forum: General Discussion and Questions
Topic: How to import int variable out of raw_repl
Replies: 5
Views: 132

Re: How to import int variable out of raw_repl

Here's a version that creates a @remote decorator and makes calling the functions a bit more natural: #!/usr/bin/env python3 import inspect import pyboard pyb = pyboard.Pyboard('/dev/cu.usbmodem3389337E34332') def remote(func): def wrapper(*args, **kwargs): return do_remote(func, *args, **kwargs) re...
by dhylands
Fri Mar 05, 2021 5:56 pm
Forum: General Discussion and Questions
Topic: How to import int variable out of raw_repl
Replies: 5
Views: 132

Re: How to import int variable out of raw_repl

Sure - if you look at the source you're sending, it looks like this: def foo(x): y = x * 2 return y foo(x) which of course fails because there is no x defined. You could change foo(x) to foo(4) or change it to assign a value to x before calling foo. You could make youre code a little more exotic and...
by dhylands
Thu Mar 04, 2021 6:00 pm
Forum: General Discussion and Questions
Topic: How to import int variable out of raw_repl
Replies: 5
Views: 132

Re: How to import int variable out of raw_repl

Try this instead: #!/usr/bin/env python3 import pyboard pyb = pyboard.Pyboard('/dev/cu.usbmodem3389337E34332') pyb.enter_raw_repl() pyb.exec('import pyb') pyb.exec('x=2') pyb.exec('y=x*2') output = pyb.exec('print(y)') pyb.exit_raw_repl() y = eval(output) print('y =', y) If you're planning on sendin...
by dhylands
Thu Mar 04, 2021 5:43 pm
Forum: ESP32 boards
Topic: Memory management issues
Replies: 1
Views: 99

Re: Memory management issues

I'll answer a couple questions. If memory is needed, then the smallest amount of memory that can be allocated is a block. So if it needs to allocate memory to store a float, then a single float will be stored in the that block, and the unsed bytes will be wasted. When you do stuff like test = 0.0 th...
by dhylands
Wed Mar 03, 2021 10:04 pm
Forum: Raspberry Pi microcontroller boards
Topic: Where can we find information about the inline assembler for Pico?
Replies: 12
Views: 421

Re: Where can we find information about the inline assembler for Pico?

The Espruino Pico has quite a bit less flash (only 384K) so in order to get things to fit, I imagine a bunch of features were turned off, and the inline assembler is probably one of those things: https://github.com/micropython/micropython/blob/680ce45323248df288ee8ebd055a4caacb3e46f3/ports/stm32/boa...
by dhylands
Wed Mar 03, 2021 6:51 pm
Forum: Raspberry Pi microcontroller boards
Topic: main.py isn't running when Pico connected to external power
Replies: 4
Views: 172

Re: main.py isn't running when Pico connected to external power

That seems to work fine for me. I created main.py with the following: import blinky and blinky.py with from machine import Pin, Timer led = Pin(25, Pin.OUT) tim = Timer() def tick(timer): global led led.toggle() tim.init(freq=2.5, mode=Timer.PERIODIC, callback=tick) I verified that powering up via U...
by dhylands
Mon Mar 01, 2021 10:29 pm
Forum: Programs, Libraries and Tools
Topic: rshell - Remote Shell
Replies: 82
Views: 45763

Re: rshell - Remote Shell

I think I screwed up the 0.0.29 release - I messed up my merge.

So I created 0.0.30.
by dhylands
Sat Feb 27, 2021 9:36 pm
Forum: Development of MicroPython
Topic: NUCLEO-L476RG firmware has only UART2 defined
Replies: 1
Views: 73

Re: NUCLEO-L476RG firmware has only UART2 defined

The USARTs support synchronous and asynchronous modes, where the UARTs only support asynchronous mode. Asynchronous mode is the mode that you use for typical serial ports. You should just keep using MICROPY_HW_UARTx_TX/RX regardless. See: https://github.com/micropython/micropython/blob/cdaec0dcaffbf...