Skip to content

Commit e7adfbf

Browse files
committed
Added RPI GPIO
1 parent 75b0af2 commit e7adfbf

11 files changed

+184
-0
lines changed

RPI GPIO/PI ZERO OVERCLOCK.txt

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
Keeping your Pi cool is key when overclocking
3+
4+
5+
Basic overclock
6+
7+
arm_freq=1000
8+
gpu_freq=500
9+
core_freq=500
10+
sdram_freq=500
11+
sdram_schmoo=0x02000020
12+
over_voltage=2
13+
sdram_over_voltage=2
14+
15+
16+
Advance Overclock
17+
18+
arm_freq=1050
19+
gpu_freq=500
20+
core_freq=500
21+
sdram_freq=500
22+
sdram_schmoo=0x02000020
23+
over_voltage=2
24+
sdram_over_voltage=2
25+
26+
27+
after we boot back up we can see if the overclock worked
28+
29+
Press F4 on your keyboard while running RetroPie and type in this command
30+
31+
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
32+

RPI GPIO/RPI USB ethernet.txt

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
config: dtoverlay=dwc2
2+
cmdline: modules-load=dwc2,g_ether
3+
file: ssh
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+

RPI GPIO/aliases.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
echo "" >> ~/.bashrc
4+
echo "# py = python3 interactive mode" >> ~/.bashrc
5+
echo "alias py='python3 -i'" >> ~/.bashrc
6+

RPI GPIO/create.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
touch $1
4+
chmod 775 $1
5+
nano $1

RPI GPIO/gpio.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from gpiozero import LED, Button
2+
from time import sleep
3+
choice = input("Do you want full controll? ")
4+
5+
led1 = LED(17)
6+
led2 = LED(27)
7+
led3 = LED(22)
8+
9+
led1.on()
10+
led2.on()
11+
led3.on()
12+
input("Press enter to continue. ")
13+
led1.off()
14+
led2.off()
15+
led3.off()
16+
17+
button1 = Button(20)
18+
button2 = Button(21)
19+
20+
def blink1():
21+
led1.blink(1,2)
22+
23+
24+
def blink2():
25+
led2.blink(0.1,0.5)
26+
27+
28+
while choice != "yes":
29+
button1.when_pressed = blink1
30+
button1.when_released = blink2
31+
button2.when_pressed = led1.off
32+
button2.when_released = led2.off
33+
sleep(1)

RPI GPIO/rpi leds.fzz

7.91 KB
Binary file not shown.

RPI GPIO/rpi leds.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
LED1 GPIO 17
2+
LED2 GPIO 27
3+
LED3 GPIO 22
4+
5+
Button1 GPIO 21
6+
Button2 GPIO 20
7+
GND

RPI GPIO/rpi leds_bb.jpg

595 KB
Loading

RPI GPIO/rpi leds_schem.jpg

153 KB
Loading

RPI GPIO/timer.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from gpiozero import LED, Button
2+
from time import sleep, time
3+
4+
led1 = LED(17)
5+
led2 = LED(27)
6+
led3 = LED(22)
7+
8+
button1 = Button(20)
9+
button2 = Button(21)
10+
11+
print("Active")
12+
led1.on()
13+
led2.off()
14+
led3.off()
15+
16+
def start():
17+
print("Started")
18+
led3.blink(0.5, 0.5)
19+
global before
20+
before = time()
21+
22+
def stop():
23+
print("Stoped")
24+
led3.off()
25+
after = time()
26+
print(str(round(after - before,2))+" S")
27+
print("")
28+
29+
while True:
30+
button1.when_pressed = start
31+
button2.when_pressed = start
32+
button1.when_released = stop
33+
button2.when_released = stop

RPI GPIO/traffic_lights.py

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
from gpiozero import LED, Button
2+
from time import sleep
3+
4+
red = LED(17)
5+
amber = LED(27)
6+
green = LED(22)
7+
8+
button1 = Button(20)
9+
button2 = Button(21)
10+
11+
green.on()
12+
amber.off()
13+
red.off()
14+
15+
def stop():
16+
print("stop")
17+
green.off()
18+
amber.on()
19+
sleep(1)
20+
amber.off()
21+
red.on()
22+
23+
def go():
24+
print("go")
25+
amber.on()
26+
red.off()
27+
sleep(1)
28+
green.on()
29+
amber.off()
30+
31+
def man():
32+
print("manual mode")
33+
state = ""
34+
while state != "man":
35+
state = input("go or stop? ")
36+
if state == "go":
37+
go()
38+
elif state == "stop":
39+
stop()
40+
41+
while True:
42+
button2.when_pressed = go
43+
button2.when_released = stop
44+
button1.when_pressed = man
45+
sleep(1)

0 commit comments

Comments
 (0)