Search found 22 matches

by stmfresser
Tue Nov 15, 2016 4:42 pm
Forum: Hardware Projects
Topic: Self balancing robot
Replies: 49
Views: 71675

Re: Self balancing robot

my python control loop code runs 30ms, it's getting slower with the time, my C control loop runs 10ms. The balance control loop needs max. 10ms.
by stmfresser
Tue Nov 15, 2016 1:44 pm
Forum: Hardware Projects
Topic: Self balancing robot
Replies: 49
Views: 71675

Re: Self balancing robot

i've built my self balancing robot and trying to port the c code into micropython. Unfortunately micropython is too slow on STM32F407 Board.
Is there any better µcontroller which is for micropython optimized.

https://www.youtube.com/watch?v=jPH4uLOQLpM
by stmfresser
Mon Sep 12, 2016 11:56 pm
Forum: General Discussion and Questions
Topic: Timer callback problem
Replies: 5
Views: 5917

Re: Timer callback problem

You should read this: http://docs.micropython.org/en/latest/pyboard/reference/isr_rules.html?highlight=interrupt You're not allowed to allocate memory inside an interrupt handler (and timer callbacks are interrupt handlers). The for loop is trying to allocate an iterator object. If you rewrite it l...
by stmfresser
Mon Sep 12, 2016 7:01 pm
Forum: General Discussion and Questions
Topic: Timer callback problem
Replies: 5
Views: 5917

Re: Timer callback problem

Yep - see an example here (that also uses classes): https://github.com/dhylands/upy-examples/blob/master/heartbeat_irq.py thanks. now i get a another error message MemoryError: memory allocation failed, heap is locked micropython runs on a STM32F407 Discovery Board MicroPython v1.8.3-26-ga56a683 on...
by stmfresser
Mon Sep 12, 2016 6:10 pm
Forum: General Discussion and Questions
Topic: Timer callback problem
Replies: 5
Views: 5917

Timer callback problem

Hello, i'm trying to toggle the leds every 1 second. i get the this error message uncaught exception in Timer(2) interrupt handler TypeError: function takes 1 positional arguments but 2 were given import pyb import micropython micropython.alloc_emergency_exception_buf(200) class A: def __init__(self...
by stmfresser
Fri Aug 19, 2016 5:28 pm
Forum: General Discussion and Questions
Topic: function similar %timeit
Replies: 2
Views: 3520

function similar %timeit

i would calculate the time of operation. Is there any function like %timeit ?
by stmfresser
Fri Aug 19, 2016 5:01 pm
Forum: General Discussion and Questions
Topic: overload operator __rmul__ does not work
Replies: 2
Views: 3178

Re: overload operator __rmul__ does not work

pfalcon wrote:Sorry, none of the __r*__ methods are supported.
Okay Thanks!
by stmfresser
Fri Aug 19, 2016 4:11 pm
Forum: General Discussion and Questions
Topic: overload operator __rmul__ does not work
Replies: 2
Views: 3178

overload operator __rmul__ does not work

i'm trying to test the overload operator __rmul__ on micropython, Unfortunately it does not work on micropython class foo: def __init__(self, data): self.data = data def __mul__(self, other): if type(other) in (int, float): return foo(self.data * other) else: return foo(self.data * other.data) def _...
by stmfresser
Tue Aug 16, 2016 5:32 pm
Forum: General Discussion and Questions
Topic: KeyboardInterrupt Ctrl+c does not work
Replies: 8
Views: 9199

Re: KeyboardInterrupt Ctrl+c does not work

dhylands wrote:I don't understand the difference between your working and non-working scenarios. Were they both flashed the same way?
Yes they were both flashed same way,
by stmfresser
Tue Aug 16, 2016 3:29 pm
Forum: General Discussion and Questions
Topic: KeyboardInterrupt Ctrl+c does not work
Replies: 8
Views: 9199

Re: KeyboardInterrupt Ctrl+c does not work

recent built of micropython did not work as always, then converted again same firmware.elf to prog.bin. After flashing, ctrl+c does work. I'm confused, Is it something wrong with objcopy? arm-none-eabi-objcopy -O binary firmware.elf prog.bin st-flash write prog.bin 0x8000000 Screen Shot 2016-08-16 a...