Skip to content

Commit

Permalink
Anpassung Ultraschall bei Überwurf
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhener committed Jul 5, 2019
1 parent 51df79c commit 1f607aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions arduino/dARts.ino
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void Ultraschall() {
// Berechnung der Entfernung
distance = duration*0.034/2;
// Prüfen ob sich jemand genähert hat
if (distance <= ultraschwelle) {
if (distance > ultraschwelle) {
// Bislang ausgabe Seriell
Serial.println("PFEILE");
}
Expand All @@ -91,6 +91,8 @@ int UltraschallMessen() {
duration = pulseIn(echoPin, HIGH);
// Berechnung der Entfernung
distance = duration*0.034/2;
// Delay
delay(100);
// Entfernung zurückgeben
return distance;
}
Expand Down Expand Up @@ -175,7 +177,7 @@ void Blinken(int Anzahl) {

void SchwelleDefinieren() {
int abstand = UltraschallMessen();
ultraschwelle = abstand - 5;
ultraschwelle = abstand + 3;
bSchwelleDefiniert = true;
}

Expand Down
5 changes: 3 additions & 2 deletions python/dARts.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,9 @@ def main():
button_off()

elif string == "PFEILE":
wurfzaehler = get_wurfzaehler()
if get_pfeile_holen() and wurfzaehler == "3":
#wurfzaehler = get_wurfzaehler()
#if get_pfeile_holen() and wurfzaehler == "3":
if get_pfeile_holen():
outputString = "PERK\n"
ser.write(outputString.encode('utf-8'))
time.sleep(int(pfeilzeit))
Expand Down

0 comments on commit 1f607aa

Please sign in to comment.