-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathring.py
executable file
·67 lines (54 loc) · 1.01 KB
/
ring.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/python
import RPi.GPIO as GPIO
from RPi.GPIO import OUT
from time import sleep
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
# beeper: pin 16, GPIO 23
beeper = 23
GPIO.setup(beeper, OUT)
def beep(ontime=1, offtime=0):
GPIO.output(beeper, True)
sleep(ontime)
GPIO.output(beeper, False)
sleep(offtime)
def klingelton(repeats=1):
for j in range(repeats):
sleep(3)
for i in range(int(1.5/(0.05+0.035))):
beep(0.04, 0.035)
def keinfreizeichenton():
for i in range(4):
beep(0.25, 0.25)
def neustartton():
beep(0.06, 0.1)
beep(0.06, 0.1)
beep(0.06, 0.1)
def herunterfahrton():
beep(0.06, 0.1)
beep(0.4, 0.1)
beep(0.06, 0.1)
def anrufanfangton():
beep(0.06, 0.1)
beep(0.06, 0.1)
def anrufendeton():
for i in range(3):
beep(0.5, 0.5)
def waehlton():
beep(0.1)
if __name__ == '__main__':
waehlton()
sleep(1)
neustartton()
# sleep(1)
# waehlton()
# sleep(1)
# keinfreizeichenton()
# sleep(1)
# waehlton()
# sleep(1)
# klingelton()
# sleep(1)
# anrufanfangton()
# sleep(1)
# anrufendeton()