-
Fototrend
Huawei P9-P9 Lite OFF topik
Új hozzászólás Aktív témák
-
petya220
senior tag
válasz petya220 #824 üzenetére
Kezd elég pofás program lenni..
import os
import glob
import time
import time
import subprocess
import RPi.GPIO as GPIO
GPIO.cleanup()
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
channel = [17,18,22,27]
GPIO.setup(channel, GPIO.OUT)
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
def read_temp_raw():
f = open(device_file, 'r')
lines = f.readlines()
f.close()
return lines
def read_temp():
lines = read_temp_raw()
while lines[0].strip()[-3:] != 'YES':
time.sleep(0.2)
lines = read_temp_raw()
equals_pos = lines[1].find('t=')
if equals_pos != -1:
temp_string = lines[1][equals_pos+2:]
temp_c = float(temp_string) / 1000.0
return temp_c
x = 0
fok = read_temp()
number_string = str(fok)
for a in range(0, 1):
if number_string[x] == "0":
print "0"
GPIO.output(17, GPIO.LOW)
GPIO.output(18, GPIO.LOW)
GPIO.output(27, GPIO.LOW)
GPIO.output(22, GPIO.LOW)
time.sleep(0.5)
if number_string[x] == "1":
print "1"
GPIO.output(17, GPIO.HIGH)
GPIO.output(18, GPIO.LOW)
GPIO.output(27, GPIO.LOW)
GPIO.output(22, GPIO.LOW)
time.sleep(0.5)
if number_string[x] == "2":
print "2"
GPIO.output(17, GPIO.LOW)
GPIO.output(18, GPIO.HIGH)
GPIO.output(27, GPIO.LOW)
GPIO.output(22, GPIO.LOW)
time.sleep(0.5)
if number_string[x] == "3":
print "3"
GPIO.output(17, GPIO.HIGH)
GPIO.output(18, GPIO.HIGH)
GPIO.output(27, GPIO.LOW)
GPIO.output(22, GPIO.LOW)
time.sleep(0.5)
if number_string[x] == "4":
print "4"
GPIO.output(17, GPIO.LOW)
GPIO.output(18, GPIO.LOW)
GPIO.output(27, GPIO.HIGH)
GPIO.output(22, GPIO.LOW)
time.sleep(0.5)
if number_string[x] == "5":
print "5"
GPIO.output(17, GPIO.HIGH)
GPIO.output(18, GPIO.LOW)
GPIO.output(27, GPIO.HIGH)
GPIO.output(22, GPIO.LOW)
time.sleep(0.5)
if number_string[x] == "6":
print "6"
GPIO.output(17, GPIO.LOW)
GPIO.output(18, GPIO.HIGH)
GPIO.output(27, GPIO.HIGH)
GPIO.output(22, GPIO.LOW)
time.sleep(0.5)
if number_string[x] == "7":
print "7"
GPIO.output(17, GPIO.HIGH)
GPIO.output(18, GPIO.HIGH)
GPIO.output(27, GPIO.HIGH)
GPIO.output(22, GPIO.LOW)
time.sleep(0.5)
if number_string[x] == "8":
print "8"
GPIO.output(17, GPIO.LOW)
GPIO.output(18, GPIO.LOW)
GPIO.output(27, GPIO.LOW)
GPIO.output(22, GPIO.HIGH)
time.sleep(0.5)
if number_string[x] == "9":
print "9"
GPIO.output(17, GPIO.HIGH)
GPIO.output(18, GPIO.LOW)
GPIO.output(27, GPIO.LOW)
GPIO.output(22, GPIO.HIGH)
x = x + 1Bocsi, hogy ide osztogatom meg a programjaimat... De mást nem érdekel.. xD (lehet,hogy titeket sem, de nem tudtok ellenkezni ) Ha zavar, akkor abbahagyom
"Neked is pörög az agyad a szarokon, amíg a mosoly a szádra kanyarodik."
Új hozzászólás Aktív témák
- Ukrajnai háború
- WLAN, WiFi, vezeték nélküli hálózat
- Kormányok / autós szimulátorok topicja
- Helldivers 2 (PC, PS5)
- iPhone topik
- AMD Ryzen 9 / 7 / 5 7***(X) "Zen 4" (AM5)
- Megjelent az iOS 17.4, minden idők egyik legfontosabb iPhone-frissítése
- gban: Ingyen kellene, de tegnapra
- Autós topik
- Óra topik
- További aktív témák...