Created
August 29, 2023 13:58
-
-
Save overas/1950710c63069c5d70289d57fffcc26d to your computer and use it in GitHub Desktop.
Microbit måler temperatur og skriver data til en fil
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from microbit import * | |
import time | |
display.show(Image.HAPPY) | |
while True: | |
if button_a.is_pressed(): | |
temperatureValues = open("temperatur.txt", "w") | |
temperatureValues.write("Minutter" + "," + "Temperatur" + "\n") | |
break | |
while True: | |
tid = str((running_time() // 1000) // 60) | |
temperatureMeasure = temperature() - 7 | |
temperatureValues.write(str(tid) + "," + str(temperatureMeasure) + "\n") | |
display.scroll(temperatureMeasure) | |
if button_b.get_presses() > 0: | |
temperatureValues.close() | |
break | |
time.sleep(60) | |
display.show(Image.HEART) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment