-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
"""lets the buzzer work""" | ||
from leaphymicropython.actuators.buzzer import set_buzzer | ||
|
||
set_buzzer(1, 255, 1000) |
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,7 @@ | ||
"""Reads the DHT22 sensor and returns temperature and humidity""" | ||
from leaphymicropython.sensors.dht22 import DHT22 | ||
|
||
sensor = DHT22(1) | ||
while True: | ||
print(sensor.read_temperature()) | ||
print(sensor.read_humidity()) |
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,7 @@ | ||
"""Reads the line sensor""" | ||
from leaphymicropython.sensors.linesensor import read_line_sensor | ||
from time import sleep | ||
|
||
while True: | ||
print(read_line_sensor(1)) | ||
sleep(1) |
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,10 @@ | ||
"""Lets the rgb-led blink""" | ||
from leaphymicropython.actuators.rgbled import RGBLed | ||
from time import sleep | ||
|
||
led = RGBLed(1, 2, 4) | ||
while True: | ||
led.set_color(255, 0, 0) | ||
sleep(1) | ||
led.set_color(0, 0, 0) | ||
sleep(1) |
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,4 @@ | ||
"""Lets the servo rotate to 90 degrees""" | ||
from leaphymicropython.actuators.servo import set_servo_angle | ||
|
||
set_servo_angle(1, 90) |
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,7 @@ | ||
"""Reads the distance""" | ||
from leaphymicropython.sensors.sonar import read_distance | ||
from time import sleep | ||
|
||
while True: | ||
print(read_distance(1)) | ||
sleep(1) |
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,4 @@ | ||
"""Lets you connect to the wifi and prints a ip address""" | ||
from leaphymicropython.utils.wifi import connect | ||
|
||
connect("wifi name","wifi password") |
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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
from leaphymicropython.utils.pins import set_pwm | ||
|
||
|
||
def set_buzzer(pin: int, freq: int): | ||
def set_buzzer(pin: int, value: int, freq: int): | ||
""" | ||
Sets the buzzer | ||
:param pin: int, the pin of the buzzer | ||
:param value: int, the value of the buzzer | ||
:param freq: int, the frequency of the buzzer | ||
""" | ||
if freq < 0 or freq > 255: | ||
raise ValueError("Buzzer values must be in between 0 and 255") | ||
set_pwm(pin, 255, freq) | ||
set_pwm(pin, value, freq) |
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