-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Francois Berder <[email protected]>
- Loading branch information
1 parent
689af76
commit 0cb903d
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
"""This example shows how to use the UNI Hall Click binding of LetMeCreate. | ||
""" | ||
|
||
from letmecreate.click import uni_hall | ||
from letmecreate.core.common import MIKROBUS_1 | ||
from letmecreate.core.gpio_monitor import GPIO_FALLING, GPIO_RAISING | ||
from time import sleep | ||
|
||
|
||
def print_hello(arg): | ||
if arg == GPIO_FALLING: | ||
print("Hello, starts dectecting north pole.") | ||
elif arg == GPIO_RAISING: | ||
print("Hello, stops dectecting north pole.") | ||
|
||
uni_hall.attach_callback(MIKROBUS_1, print_hello) | ||
print("Callback is now active for 15 seconds.") | ||
print("Move the north pole of a magnet over the sensor to print \"hello\".") | ||
sleep(15) |