示例#1
0
import LCD
import time
import RPi.GPIO as GPIO

print("Hello")

temp = LCD.HD44780()
temp.message("Hello\nWorld!")
time.sleep(5)
temp.clear()
GPIO.cleanup()
示例#2
0
import time
import spidev
import AccelerometerClass as Accl
import RPi.GPIO as GPIO
import LCD

GPIO.cleanup()

# define button pin
button1 = 18

# define buzzer pin
buzzerPin = 26

myArray = []
lcd = LCD.HD44780()
foodArray = []
pitch = 500
duration = .2
pitches = []
durations = []
song = []


def buzz(pitch, duration):
    period = 1.0 / pitch
    delay = period / 2
    cycles = int(duration * pitch)

    for i in range(cycles):
        GPIO.output(buzzerPin, True)