diff --git a/README.md b/README.md index 9c08ac8..61e814f 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/adc/temperature.py b/adc/temperature.py index a62a23a..77b78ea 100644 --- a/adc/temperature.py +++ b/adc/temperature.py @@ -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) diff --git a/pio/pio_blink.py b/pio/pio_blink.py index 566a3cf..e395204 100644 --- a/pio/pio_blink.py +++ b/pio/pio_blink.py @@ -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] diff --git a/pio/pio_spi.py b/pio/pio_spi.py index eb5490a..30f02c3 100644 --- a/pio/pio_spi.py +++ b/pio/pio_spi.py @@ -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 \ No newline at end of file + return rdata