This commit is contained in:
PJB123456
2023-12-08 08:25:22 +08:00
parent 41aeb553c0
commit 77bfab43de
13 changed files with 14 additions and 17 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
########################################################################
# Filename : Hello.py
# Description : Print "Hello World!".
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/27
########################################################################
+1 -1
View File
@@ -2,7 +2,7 @@
########################################################################
# Filename : Blink.py
# Description : Basic usage of GPIO. Let led blink.
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/28
########################################################################
import RPi.GPIO as GPIO
+1 -1
View File
@@ -2,7 +2,7 @@
########################################################################
# Filename : Blink.py
# Description : Basic usage of GPIO. Let led blink.
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/26
########################################################################
from gpiozero import LED
@@ -2,7 +2,7 @@
########################################################################
# Filename : ButtonLED.py
# Description : Control led with button
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/28
########################################################################
import RPi.GPIO as GPIO
@@ -2,7 +2,7 @@
########################################################################
# Filename : Tablelamp.py
# Description : a DIY MINI table lamp
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/28
########################################################################
import RPi.GPIO as GPIO
@@ -2,7 +2,7 @@
########################################################################
# Filename : LightWater.py
# Description : Use LEDBar Graph(10 LED)
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/28
########################################################################
import RPi.GPIO as GPIO
+1 -1
View File
@@ -2,7 +2,7 @@
########################################################################
# Filename : Doorbell.py
# Description : Make doorbell with buzzer and button
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/28
########################################################################
import RPi.GPIO as GPIO
@@ -2,7 +2,7 @@
#############################################################################
# Filename : LEDMatrix.py
# Description : Control LEDMatrix with 74HC595
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/28
########################################################################
import RPi.GPIO as GPIO
+1 -1
View File
@@ -2,7 +2,7 @@
########################################################################
# Filename : SenseLED.py
# Description : Control led with infrared Motion sensor.
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/28
########################################################################
import RPi.GPIO as GPIO
@@ -2,7 +2,7 @@
########################################################################
# Filename : UltrasonicRanging.py
# Description : Get distance via UltrasonicRanging sensor
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/28
########################################################################
import RPi.GPIO as GPIO
@@ -2,7 +2,7 @@
########################################################################
# Filename : MPU6050RAW.py
# Description : Read data of MPU6050.
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/28
########################################################################
import MPU6050
@@ -2,7 +2,7 @@
#############################################################################
# Filename : LightWater03.py
# Description : Control LED with 74HC595 on the DIY circuit board
# Author : www.freenove.com
# auther : www.freenove.com
# modification: 2019/12/28
########################################################################
import RPi.GPIO as GPIO
@@ -22,11 +22,8 @@ def loop():
stopAlertor()
print ('alertor turned off <<<')
def alertor():
for x in range(0,361): # Make frequency of the alertor consistent with the sine wave
sinVal = math.sin(x * (math.pi / 180.0)) # calculate the sine value
toneVal = 2000 + sinVal * 500 # Add to the resonant frequency with a Weighted
b.play(Tone(toneVal)) # Change Frequency of PWM to toneVal
time.sleep(0.001)
buzzer.play(Tone(220.0))
time.sleep(0.1)
def stopAlertor():
buzzer.stop()