We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 689af76 commit 0cb903dCopy full SHA for 0cb903d
examples/uni_hall_example.py
@@ -0,0 +1,20 @@
1
+#!/usr/bin/env python3
2
+"""This example shows how to use the UNI Hall Click binding of LetMeCreate.
3
+"""
4
+
5
+from letmecreate.click import uni_hall
6
+from letmecreate.core.common import MIKROBUS_1
7
+from letmecreate.core.gpio_monitor import GPIO_FALLING, GPIO_RAISING
8
+from time import sleep
9
10
11
+def print_hello(arg):
12
+ if arg == GPIO_FALLING:
13
+ print("Hello, starts dectecting north pole.")
14
+ elif arg == GPIO_RAISING:
15
+ print("Hello, stops dectecting north pole.")
16
17
+uni_hall.attach_callback(MIKROBUS_1, print_hello)
18
+print("Callback is now active for 15 seconds.")
19
+print("Move the north pole of a magnet over the sensor to print \"hello\".")
20
+sleep(15)
0 commit comments