Skip to content

Commit

Permalink
Fått til sensor funksjonalitet
Browse files Browse the repository at this point in the history
Fått til både touch og ultrasonic sensor.
  • Loading branch information
martaron committed Sep 3, 2025
1 parent f5a8782 commit 4a446d1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions oving_2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,23 @@

# Write your program here.
ev3.speaker.beep()


startBtn = TouchSensor(port=Port.S1)
usSensor = UltrasonicSensor(port=Port.S3)

isPressed = False

while True:

if(startBtn.pressed() and isPressed == False):
print("Knapp funker\n",
"Starter program.")
isPressed = True

elif(isPressed == True):
print(usSensor.distance())



print("The end..")

0 comments on commit 4a446d1

Please sign in to comment.