Merge branch 'master' of github.com:raspberrypi/pico-micropython-examples

pull/22/head
Alasdair Allan 2021-02-23 09:44:38 +00:00
commit 1b3960223b
4 zmienionych plików z 8 dodań i 5 usunięć

Wyświetl plik

@ -1,9 +1,9 @@
# MicroPython Examples
Examples to accompany the "Raspberry Pi Pico Python SDK" book.
Examples to accompany the "[Raspberry Pi Pico Python SDK](https://datasheets.raspberrypi.org/pico/raspberry-pi-pico-python-sdk.pdf)" book published by Raspberry Pi Trading, which forms part of the technical documentation in support of Raspberry Pi Pico and the MicroPython port to RP2040.
## Contributions
While we welcome pull requests to contribute further example code, please do not link to personal sites or to your social media. Contributions which are fully documented with an AsciiDoc description and a Fritzing wiring diagram, e.g. see the [NeoPixel Ring](https://github.com/raspberrypi/pico-micropython-examples/tree/master/pio/neopixel_ring) example, stand more chance of inclusion.
Our example code is under the BSD-3-Clause License. Any contributions must be under the same license.
Our example code is under the BSD-3-Clause License: any contributions must be under the same license.

Wyświetl plik

@ -7,6 +7,8 @@ conversion_factor = 3.3 / (65535)
while True:
reading = sensor_temp.read_u16() * conversion_factor
# The temperature sensor measures the Vbe voltage of a biased bipolar diode, connected to the fifth ADC channel
# Typically, Vbe = 0.706V at 27 degrees C, with a slope of -1.721mV (0.001721) per degree.
temperature = 27 - (reading - 0.706)/0.001721
print(temperature)
utime.sleep(2)

Wyświetl plik

@ -1,10 +1,10 @@
import time
from rp2 import PIO, asm_pio
import rp2
from machine import Pin
# Define the blink program. It has one GPIO to bind to on the set instruction, which is an output pin.
# Use lots of delays to make the blinking visible by eye.
@asm_pio(set_init=rp2.PIO.OUT_LOW)
@rp2.asm_pio(set_init=rp2.PIO.OUT_LOW)
def blink():
wrap_target()
set(pins, 1) [31]

Wyświetl plik

@ -1,3 +1,4 @@
import rp2
from machine import Pin
@rp2.asm_pio(out_shiftdir=0, autopull=True, pull_thresh=8, autopush=True, push_thresh=8, sideset_init=(rp2.PIO.OUT_LOW, rp2.PIO.OUT_HIGH), out_init=rp2.PIO.OUT_LOW)
@ -45,4 +46,4 @@ class PIOSPI:
for b in wdata:
self._sm.put(b << 24)
rdata.append(self._sm.get() & 0xff)
return rdata
return rdata