Examples (similar to Arduino)

Showroom for MicroPython related hardware projects.
Target audience: Users wanting to show off their project!
User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Examples (similar to Arduino)

Post by dhylands » Sun Oct 26, 2014 5:37 pm

It looks like ic_test2.py is a bad example (i.e. it no longer works).

I should probably just remove it.

ic_test2 was written when I was introducing support for Input Capture, but before the notion of channels was in the code.

ic_test.py is quite similar, but works, and is what is mentioned here: http://wiki.micropython.org/platforms/b ... r-Examples

The ic_cb routine is an interrupt callback routine, and the interrupt handler passes the timer object as the one and only parameter.

So in ic_test.py, the tim argument passed to the callback will be the same as t2.

You can get additional information passed to your callback by using a bound function, like what was done in this example:
https://github.com/dhylands/upy-example ... eat_irq.py (the function and self are bound together, hence the name bound function).

Post Reply