![Adafruit Feather M4 Express Скачать руководство пользователя страница 162](http://html1.mh-extra.com/html/adafruit/feather-m4-express/feather-m4-express_manual_2845857162.webp)
Logging the Temperature
The way boot.py works is by checking to see if the pin you specified in the switch setup in your code is connected to a
ground pin. If it is, it changes the read-write state of the file system, so the CircuitPython core can begin logging the
temperature to the board.
For help finding the correct pins, see the wiring diagrams and information in the
Find the Pins section of the
CircuitPython Digital In & Out guide
(https://adafru.it/Bes)
. Instead of wiring up a switch, however, you'll be connecting
the pin directly to ground with alligator clips or jumper wires.
import time
import board
import digitalio
import microcontroller
led = digitalio.DigitalInOut(board.D13)
led.switch_to_output()
try:
with open("/temperature.txt", "a") as fp:
while True:
temp = microcontroller.cpu.temperature
# do the C-to-F conversion here if you would like
fp.write('{0:f}\n'.format(temp))
fp.flush()
led.value = not led.value
time.sleep(1)
except OSError as e:
delay = 0.5
if e.args[0] == 28:
delay = 0.25
while True:
led.value = not led.value
time.sleep(delay)
© Adafruit Industries
https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51
Page 167 of 183
Содержание Feather M4 Express
Страница 1: ...Adafruit Feather M4 Express Created by lady ada Last updated on 2019 03 04 10 41 14 PM UTC...
Страница 5: ...Adafruit Industries https learn adafruit com adafruit feather m4 express atsamd51 Page 10 of 183...
Страница 58: ...Adafruit Industries https learn adafruit com adafruit feather m4 express atsamd51 Page 63 of 183...
Страница 164: ...Adafruit Industries https learn adafruit com adafruit feather m4 express atsamd51 Page 169 of 183...
Страница 168: ...Adafruit Industries https learn adafruit com adafruit feather m4 express atsamd51 Page 173 of 183...