...
Code: Alles auswählen
if __name__ == "__main__":
import time
import pigpio
import readRPM
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
count = 5
RPM_GPIO = 4
RUN_TIME = 9600.0
SAMPLE_TIME = 2.0
pi = pigpio.pi()
p = readRPM.reader(pi, RPM_GPIO)
start = time.time()
while (time.time() - start) < RUN_TIME:
input_state = GPIO.input(20)
if input_state == False:
if count < 24:
count = count + 1
RPM = p.RPM()
print('Level', count, 'RPM={}'.format(int(RPM+0.5)))
time.sleep(SAMPLE_TIME)
input_state = GPIO.input(21)
if input_state == False:
if count > 1:
count = count - 1
RPM = p.RPM()
print('Level', count, 'RPM={}'.format(int(RPM+0.5)))
time.sleep(SAMPLE_TIME)
RPM = p.RPM()
time.sleep(SAMPLE_TIME)
print("RPM={}".format(int(RPM+0.5)))
p.cancel()
pi.stop()
Nun noch meine Werte aus der Tabelle verknüpfen das er anzeigt:
Du bist in Level "6" machst ">60" RPM das entspricht einer Leistung von "105" Watt
Muss ich da ein Array bauen, oder eine Matrix, oder kann ich gar eine *.csv einlesen?
Aber nu erstmal Feierabend und DANKE nochmal.