spi: Make Spi write() work from SWIG with typemaps
[contrib/mraa.git] / examples / python / hello_isr.py
index 01c5bf5..cb02488 100644 (file)
 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
 
-import pymaa as maa
+import mraa
+import time
 
+class Counter:
+  count = 0
+
+c = Counter()
+
+# inside a python interupt you cannot use 'basic' types so you'll need to use
+# objects
 def test(args):
   print("wooo")
+  c.count+=1
+
+x = mraa.Gpio(6)
+x.dir(mraa.DIR_IN)
+x.isr(mraa.EDGE_BOTH, test, test)
 
-x = maa.Gpio(6)
-x.dir(maa.DIR_IN)
-x.isr(maa.EDGE_BOTH, test, test)
+time.sleep(500)