From 50001662b34ff2674ff5cedf14eba34c67095dd0 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Mon, 17 Apr 2017 19:06:41 +0000 Subject: [PATCH] Metermessfunktion hinzugefuegt --- skalieren.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/skalieren.py b/skalieren.py index 85b726a..641efe2 100644 --- a/skalieren.py +++ b/skalieren.py @@ -4,19 +4,25 @@ import time core=CORE() core.setSensorValues() core.printValues() -print("Zum fortfahren beliebige Taste druecken..."); -getch.getch(); -core.turnRight(); -startTime=time.time(); -whileStatus=0 -while True: - if core.infarotMitteRechts.getValue(): - if whileStatus==1: - runTime=time.time()-startTime; - core.stop(); - break; - else: - whileStatus=1; -print("Die ausfuehrzeit betraegt {0} Sekunden.".format(runTime)); +def trackTime(): + + startTime=time.time(); + whileStatus=0 + while True: + if core.infarotMitteRechts.getValue(): + if whileStatus==1: + print("Die ausfuehrzeit betraegt {0} Sekunden.".format(time.time()-startTime)); + break; + else: + whileStatus=1; +print("Auswaehlen: Sekunden pro Meter(m) oder Sekunden pro turn..."); +if(getch.getch()=='m'): + core.forward(); + trackTime(); + core.stop(); +else: + core.turnRight(); + trackTime(); + core.stop();