kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Merge pull request #397 from pimoroni/hel_more_tufty_examples
Add boot button to button test, new LED PWM examplepatch-badger2040-fixups
commit
a6458d2321
|
@ -71,6 +71,7 @@ We also maintain a C++/CMake boilerplate with GitHub workflows configured for te
|
||||||
* Pico Display 2.0 - https://shop.pimoroni.com/products/pico-display-pack-2-0
|
* Pico Display 2.0 - https://shop.pimoroni.com/products/pico-display-pack-2-0
|
||||||
|
|
||||||
## SHIMs
|
## SHIMs
|
||||||
|
|
||||||
* LiPo SHIM for Pico - https://shop.pimoroni.com/products/pico-lipo-shim
|
* LiPo SHIM for Pico - https://shop.pimoroni.com/products/pico-lipo-shim
|
||||||
* Motor SHIM for Pico - https://shop.pimoroni.com/products/motor-shim-for-pico
|
* Motor SHIM for Pico - https://shop.pimoroni.com/products/motor-shim-for-pico
|
||||||
|
|
||||||
|
@ -79,6 +80,9 @@ We also maintain a C++/CMake boilerplate with GitHub workflows configured for te
|
||||||
* Plasma 2040 (LED strip driver) - https://shop.pimoroni.com/products/plasma-2040
|
* Plasma 2040 (LED strip driver) - https://shop.pimoroni.com/products/plasma-2040
|
||||||
* Interstate 75 (HUB75 driver) - https://shop.pimoroni.com/products/interstate-75
|
* Interstate 75 (HUB75 driver) - https://shop.pimoroni.com/products/interstate-75
|
||||||
* Badger 2040 (E Ink badge) - https://shop.pimoroni.com/products/badger-2040
|
* Badger 2040 (E Ink badge) - https://shop.pimoroni.com/products/badger-2040
|
||||||
|
* Servo 2040 (18 Channel Servo Controller) - https://shop.pimoroni.com/products/servo-2040
|
||||||
|
* Motor 2040 (Quad Motor+Encoder Controller) - https://shop.pimoroni.com/products/motor-2040
|
||||||
|
* Tufty 2040 (LCD badge) - https://shop.pimoroni.com/products/tufty-2040
|
||||||
|
|
||||||
## Breakouts
|
## Breakouts
|
||||||
|
|
||||||
|
@ -109,6 +113,7 @@ We also maintain a C++/CMake boilerplate with GitHub workflows configured for te
|
||||||
* PWM3901/PAA5100JE - Near Optical Flow Sensor - https://shop.pimoroni.com/products/paa5100je-optical-tracking-spi-breakout
|
* PWM3901/PAA5100JE - Near Optical Flow Sensor - https://shop.pimoroni.com/products/paa5100je-optical-tracking-spi-breakout
|
||||||
* ICP10125 - High Accuracy Pressure / Altitude / Temperature Sensor - https://shop.pimoroni.com/products/icp10125-air-pressure-breakout
|
* ICP10125 - High Accuracy Pressure / Altitude / Temperature Sensor - https://shop.pimoroni.com/products/icp10125-air-pressure-breakout
|
||||||
* SCD41 CO2 Sensor (Carbon Dioxide / Temperature / Humidity) - https://shop.pimoroni.com/products/scd41-co2-sensor-breakout
|
* SCD41 CO2 Sensor (Carbon Dioxide / Temperature / Humidity) - https://shop.pimoroni.com/products/scd41-co2-sensor-breakout
|
||||||
|
* VL53L5CX 8x8 Time of Flight Array Sensor - https://shop.pimoroni.com/products/vl53l5cx-time-of-flight-tof-sensor-breakout
|
||||||
|
|
||||||
|
|
||||||
# Tutorials & Guides
|
# Tutorials & Guides
|
||||||
|
@ -118,3 +123,6 @@ We also maintain a C++/CMake boilerplate with GitHub workflows configured for te
|
||||||
- :link: [Getting Started with Interstate 75](https://learn.pimoroni.com/article/getting-started-with-interstate-75)
|
- :link: [Getting Started with Interstate 75](https://learn.pimoroni.com/article/getting-started-with-interstate-75)
|
||||||
- :link: [Getting Started with Plasma 2040](https://learn.pimoroni.com/article/plasma-2040)
|
- :link: [Getting Started with Plasma 2040](https://learn.pimoroni.com/article/plasma-2040)
|
||||||
- :link: [Assembling Keybow 2040](https://learn.pimoroni.com/article/assembling-keybow-2040)
|
- :link: [Assembling Keybow 2040](https://learn.pimoroni.com/article/assembling-keybow-2040)
|
||||||
|
- :link: [Getting Started with Badger 2040](https://learn.pimoroni.com/article/getting-started-with-badger-2040)
|
||||||
|
- :link: [MicroPython and VL53L5CX](https://learn.pimoroni.com/article/micropython-and-vl53l5cx)
|
||||||
|
- :link: [Getting Started with Tufty 2040](https://learn.pimoroni.com/article/getting-started-with-tufty-2040)
|
||||||
|
|
|
@ -14,6 +14,7 @@ button_b = Button(8, invert=False)
|
||||||
button_c = Button(9, invert=False)
|
button_c = Button(9, invert=False)
|
||||||
button_up = Button(22, invert=False)
|
button_up = Button(22, invert=False)
|
||||||
button_down = Button(6, invert=False)
|
button_down = Button(6, invert=False)
|
||||||
|
button_boot = Button(23, invert=True)
|
||||||
|
|
||||||
WHITE = display.create_pen(255, 255, 255)
|
WHITE = display.create_pen(255, 255, 255)
|
||||||
BLACK = display.create_pen(0, 0, 0)
|
BLACK = display.create_pen(0, 0, 0)
|
||||||
|
@ -22,6 +23,7 @@ MAGENTA = display.create_pen(255, 0, 255)
|
||||||
YELLOW = display.create_pen(255, 255, 0)
|
YELLOW = display.create_pen(255, 255, 0)
|
||||||
RED = display.create_pen(255, 0, 0)
|
RED = display.create_pen(255, 0, 0)
|
||||||
GREEN = display.create_pen(0, 255, 0)
|
GREEN = display.create_pen(0, 255, 0)
|
||||||
|
BLUE = display.create_pen(0, 0, 255)
|
||||||
|
|
||||||
WIDTH, HEIGHT = display.get_bounds()
|
WIDTH, HEIGHT = display.get_bounds()
|
||||||
|
|
||||||
|
@ -54,7 +56,7 @@ while True:
|
||||||
display.set_pen(BLACK)
|
display.set_pen(BLACK)
|
||||||
display.clear()
|
display.clear()
|
||||||
display.set_pen(YELLOW)
|
display.set_pen(YELLOW)
|
||||||
display.text("Button up pressed", 10, 10, WIDTH - 10, 3)
|
display.text("Button UP pressed", 10, 10, WIDTH - 10, 3)
|
||||||
display.update()
|
display.update()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
@ -62,7 +64,15 @@ while True:
|
||||||
display.set_pen(BLACK)
|
display.set_pen(BLACK)
|
||||||
display.clear()
|
display.clear()
|
||||||
display.set_pen(GREEN)
|
display.set_pen(GREEN)
|
||||||
display.text("Button down pressed", 10, 10, WIDTH - 10, 3)
|
display.text("Button DOWN pressed", 10, 10, WIDTH - 10, 3)
|
||||||
|
display.update()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
elif button_boot.is_pressed:
|
||||||
|
display.set_pen(BLACK)
|
||||||
|
display.clear()
|
||||||
|
display.set_pen(BLUE)
|
||||||
|
display.text("Button BOOT/USR pressed", 10, 10, WIDTH - 10, 3)
|
||||||
display.update()
|
display.update()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
# This example shows how you can control the brightness of Tufty's activity LED, using PWM.
|
||||||
|
# More about PWM / frequency / duty cycle here: https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico/7
|
||||||
|
|
||||||
|
from machine import Pin, PWM
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
pwm = PWM(Pin(25))
|
||||||
|
|
||||||
|
pwm.freq(1000)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
for duty in range(65025):
|
||||||
|
pwm.duty_u16(duty)
|
||||||
|
sleep(0.0001)
|
||||||
|
for duty in range(65025, 0, -1):
|
||||||
|
pwm.duty_u16(duty)
|
||||||
|
sleep(0.0001)
|
Ładowanie…
Reference in New Issue