-
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
- Telekom otthoni szolgáltatások (TV, internet, telefon)
- Xbox Series X|S
- Anglia - élmények, tapasztalatok
- Konzolokról KULTURÁLT módon
- BestBuy ruhás topik
- Milyen billentyűzetet vegyek?
- 3D nyomtatás
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- Kihívás a középkategóriában: teszten a Radeon RX 7600 XT
- NVIDIA GeForce RTX 4080 /4080S / 4090 (AD103 / 102)
- További aktív témák...