Search found 11 matches

by thejoker
Wed Sep 19, 2018 4:08 pm
Forum: MicroPython pyboard
Topic: I2C read/write error handling
Replies: 3
Views: 2900

Re: I2C read/write error handling

@Peter: Correct, putty is the terminal I use to issue commands to the board. On-topic though, I solved the problem! It was hardware related, and had to do with parasitic capacitance. Fortunately not micropython related. Thank you for helping me shift my focus from the micropython board to my hardwar...
by thejoker
Wed Sep 19, 2018 4:05 pm
Forum: MicroPython pyboard
Topic: Synchronous sampling rate
Replies: 7
Views: 4292

Re: Synchronous sampling rate

... Nothing to do with list comprehensions but the way you're creating a list by iteratively appending an item. If you KNOW the size upfront, create it with one statement. You are absolutely right my friend. I tested it, and your suggestion is far superior in terms of speed. Thanks for learning me ...
by thejoker
Tue Sep 18, 2018 8:27 pm
Forum: MicroPython pyboard
Topic: I2C read/write error handling
Replies: 3
Views: 2900

I2C read/write error handling

Dear reader, I currently get the following error message semi-regularly when using the I2C communication protocol: OSError: [Errno 5] EIO. Now I've looked up what it means and apparently it's an Input/Output error (I/O error). I found a thread of a few months ago where someone had a similar problem,...
by thejoker
Tue Sep 18, 2018 8:04 pm
Forum: MicroPython pyboard
Topic: Synchronous sampling rate
Replies: 7
Views: 4292

Re: Synchronous sampling rate

Thanks for your suggestion Peter, but I decided to solve my sampling problem in a bit more dirty way. It's still effective to achieve synchronous sampling rate, so I'm going to post my code here in case anyone has the same problem somewhere in the future: import time # Define sampling time, amount ...
by thejoker
Tue Sep 18, 2018 8:02 pm
Forum: MicroPython pyboard
Topic: Timers crash file IO
Replies: 3
Views: 2482

Re: Timers crash file IO

Got it. I chipped away at the problem and isolated the bug. There is a bug with file append on pyboard v 1.1 . Keeping the file open for a while and making multiple writes causes the (implicit) close file to hang. I've logged it on github. I am also working on a project where I write sensor data to...
by thejoker
Sat Sep 01, 2018 7:09 am
Forum: MicroPython pyboard
Topic: Synchronous sampling rate
Replies: 7
Views: 4292

Re: Synchronous sampling rate

Thanks for your suggestion Peter, but I decided to solve my sampling problem in a bit more dirty way. It's still effective to achieve synchronous sampling rate, so I'm going to post my code here in case anyone has the same problem somewhere in the future: import time # Define sampling time, amount o...
by thejoker
Thu Aug 30, 2018 7:21 pm
Forum: MicroPython pyboard
Topic: Timer callback function
Replies: 3
Views: 2434

Re: Timer callback function

I found the problem:
Note: Memory can’t be allocated during a callback (an interrupt) and so exceptions raised within a callback don’t give much information
by thejoker
Thu Aug 30, 2018 7:01 pm
Forum: MicroPython pyboard
Topic: Timer callback function
Replies: 3
Views: 2434

Timer callback function

Dear reader, I am trying to make sense of the micropython timer.callback() function, but I can't say I understand it very well. My idea was to use the following code to call a function every 1 second: import pyb import time def tick(): print(time.ticks_ms()) # Create timer which calls the function '...
by thejoker
Wed Aug 22, 2018 8:54 pm
Forum: MicroPython pyboard
Topic: Synchronous sampling rate
Replies: 7
Views: 4292

Synchronous sampling rate

Dear reader, I am trying to create a micropython application which controls an electromechanical device. To achieve this I want to sample my sensor at a regular interval, every 100 milliseconds. Now my question: How can I force my pyboard to run the same piece of code every 100 milliseconds? Here is...
by thejoker
Tue Aug 14, 2018 4:38 pm
Forum: MicroPython pyboard
Topic: Combining two bytes to one 16-bit object
Replies: 5
Views: 9696

Re: Combining two bytes to one 16-bit object

Thank you for your reply. I found a different (maybe easier) way to concatenate two bytes from two 'bytes'-objects into one 'bytes'-object: highbyte = i2c.mem_read(1, address, addr) lowbyte = i2c.mem_read(1, address, addr+1) twobytes = highbyte + lowbyte ... For many I2C devices you can read both by...