Search found 18 matches

by scardig
Thu Jan 03, 2019 6:33 pm
Forum: MicroPython pyboard
Topic: Run a function periodically
Replies: 4
Views: 301

Re: Run a function periodically

Philosophix wrote:
Thu Jan 03, 2019 4:49 pm
In that case the cose seems reasonable. Is it not working?
It's working well :) . I was asking if you can provide a review of the code to spot problems / provide a better solution.

Tnx
by scardig
Thu Jan 03, 2019 3:38 pm
Forum: MicroPython pyboard
Topic: Run a function periodically
Replies: 4
Views: 301

Re: Run a function periodically

Every 200ms I need to read a sensor value via I2C and forward it via ethernet (the run time of my function should be << 200ms but something may go wrong). So every time the timer fires, master_timer is set to 1 and the IF statement in the main loop will continously check for it so that my funtion wi...
by scardig
Thu Jan 03, 2019 9:12 am
Forum: MicroPython pyboard
Topic: Run a function periodically
Replies: 4
Views: 301

Run a function periodically

Hello, I need to run a function every 200ms so here is some code. Am I on the right way ? def tick(timer): global master_timer if master_timer == 1: print("Alert") # exit/reset/.... master_timer = 1 def main(): global master_timer master_timer = 0 tim = pyb.Timer(4, freq = 5) tim.callback(tick) whil...
by scardig
Wed Nov 07, 2018 4:02 pm
Forum: MicroPython pyboard
Topic: Pyboard and SMBUS
Replies: 1
Views: 368

Pyboard and SMBUS

Hello, I have to use a Pyboard V1.1 to monitor a LTC4015 Battery charger (datasheet here: https://www.analog.com/media/en/technical-documentation/data-sheets/4015fb.pdf ) that can be controlled via Smbus: is the I2C lib of the pyboard suitable for this purpose or do I need to adapt it given the requ...
by scardig
Thu Nov 01, 2018 9:52 am
Forum: MicroPython pyboard
Topic: Pyboard + WIZ850io
Replies: 0
Views: 257

Pyboard + WIZ850io

Hello, I'm using a Pyboard1.1 + a WIZ850io ethernet module. I installed a pyboard firmware with network module and followed instructions at: http://docs.micropython.org/en/latest/library/network.WIZNET5K.html but with no success, that is: nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin....
by scardig
Wed May 02, 2018 5:51 pm
Forum: MicroPython pyboard
Topic: Advices for "mission-critical" applications
Replies: 4
Views: 592

Re: Advices for "mission-critical" applications

I think you need to clarify what you mean by "dangerous situations". If you mean danger to life and limb (fire, electrocution and suchlike) you need much more specialist advice, both technical and legal, than you are likely to receive in this forum. Even if the only risk is of (say) burning out a m...
by scardig
Tue May 01, 2018 2:24 pm
Forum: MicroPython pyboard
Topic: Advices for "mission-critical" applications
Replies: 4
Views: 592

Advices for "mission-critical" applications

Ok, maybe "mission-critical" is a bit exagerated but I refer to real world applications where a failing control unit may lead to a damage to the system. As an example: if at some point in time my main script will crash it will leave the pyboard in the last state (ie timers go on, outputs will remain...
by scardig
Mon Apr 23, 2018 10:06 am
Forum: MicroPython pyboard
Topic: Interrupt and ADC
Replies: 3
Views: 637

Re: Interrupt and ADC

It looks OK, but it won't terminate because there's no exit from the while True loop. You might want to look at the ADC.read_timed_multi in the latest firmware which provides a means of reading multiple ADC's in response to a timer tick. This might offer smaller code. Thanx. Two questions: 1. Since...
by scardig
Mon Apr 23, 2018 8:33 am
Forum: MicroPython pyboard
Topic: Interrupt and ADC
Replies: 3
Views: 637

Interrupt and ADC

Hello, here is a code snippet to achieve the following: 1. Read 10 digital values on X1,X2,X3,X4,X5,X6 at 5 Hz 2. Perform a "calculation" on such values 3. goto 1 Do you find it correct ? import array import utime, time import micropython micropython.alloc_emergency_exception_buf(100) NSAMPLES = 10 ...
by scardig
Mon Feb 05, 2018 4:17 pm
Forum: MicroPython pyboard
Topic: Pyboard debugging while embedded: powering
Replies: 3
Views: 609

Re: Pyboard debugging while embedded: powering

If you had a USB->UART module like a CP2102 or FTDI, isn't it possible just to connect common GND and RX/TX? Then you can monitor without having to wire through the Micro USB port (and therefore avoid automatically joining V+ to your laptop). You're right but I will "waste" two pins on the pyboard ...