kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Add PWM example, tweak readmes
rodzic
bfa9fe9527
commit
1e47184c84
|
@ -5,6 +5,7 @@
|
|||
- [Button Test](#button-test)
|
||||
- [Daily Activity](#daily-activity)
|
||||
- [Image Gallery](#image-gallery)
|
||||
- [LED PWM](#led-pwm)
|
||||
- [News](#news)
|
||||
- [PlaceKitten](#placekitten)
|
||||
- [Quote of the Day](#quote-of-the-day)
|
||||
|
@ -41,6 +42,11 @@ Generate a random activity from Bored API.
|
|||
|
||||
This photo frame example displays local images on Inky Frame and lets you switch between them with the buttons. Use `image_gallery.py` if your images are stored on your Pico, or `image_gallery_sd.py` if the images are on your SD card.
|
||||
|
||||
### LED PWM
|
||||
[led_pwm.py](led_pwm.py)
|
||||
|
||||
A basic example showing how you can control the brightness of Inky Frame's LEDs using PWM.
|
||||
|
||||
### News
|
||||
[inky_frame_news.py](inky_frame_news.py)
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# Image Gallery <!-- omit in toc -->
|
||||
|
||||
- [Image transfer instructions](#image-transfer-instructions)
|
||||
- [image_gallery.py](#image_gallerypy)
|
||||
- [image_gallery_sd.py](#image_gallery_sdpy)
|
||||
- [Image Credits](#image-credits)
|
||||
|
||||
## Image transfer instructions
|
||||
|
||||
### image_gallery.py
|
||||
|
||||
Copy the images to your Pico W using Thonny.
|
||||
|
||||
### image_gallery_sd.py
|
||||
|
||||
Pop an SD card into your computer to copy the images across. (Alternatively, you can transfer them using Thonny, but you will have to mount the SD card using the REPL first).
|
||||
|
||||
This example requires `sdcard.mpy` from `common/lib` - copy this file into `lib` on your Pico W.
|
||||
|
||||
- [/micropython/examples/common](../common)
|
||||
|
||||
## Image Credits
|
||||
|
||||
Sample images from the Webb Space Telescope (credit: NASA, ESA, CSA, and STScI).
|
||||
Find more gorgeous images and info @ https://webbtelescope.org/
|
||||
|
||||
... and Raspberry Pi <3
|
|
@ -1,8 +1,5 @@
|
|||
# An offline image gallery that switches between five jpg images
|
||||
# Copy them into your Pico's flash using Thonny.
|
||||
# Sample images are taken by the Webb Space Telescope
|
||||
# Credit: NASA and the Space Telescope Science Institute (STScI).
|
||||
# More images and info @ https://webbtelescope.org/
|
||||
# If you want to use your own images they must be 600 x 448 pixels or smaller
|
||||
# and saved as *non-progressive* jpgs
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# An offline image gallery that switches between five jpg images
|
||||
# on your SD card (copy them across by plugging your SD into a computer).
|
||||
# Sample images are taken by the Webb Space Telescope
|
||||
# Credit: NASA and the Space Telescope Science Institute (STScI).
|
||||
# More images and info @ https://webbtelescope.org/
|
||||
# If you want to use your own images they must be 600 x 448 pixels or smaller
|
||||
# and saved as *non-progressive* jpgs
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# Control the brightness of Inky Frame's LEDs 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
|
||||
|
||||
led_activity = PWM(Pin(6))
|
||||
|
||||
# we're just PWMing the activity LED in this demo
|
||||
# but here are the pins for the other LEDs for reference
|
||||
led_connect = PWM(Pin(7))
|
||||
led_a = PWM(Pin(11))
|
||||
led_b = PWM(Pin(12))
|
||||
led_c = PWM(Pin(13))
|
||||
led_d = PWM(Pin(14))
|
||||
led_e = PWM(Pin(15))
|
||||
|
||||
led_activity.freq(1000)
|
||||
|
||||
while True:
|
||||
for duty in range(65025):
|
||||
led_activity.duty_u16(duty)
|
||||
sleep(0.0001)
|
||||
for duty in range(65025, 0, -1):
|
||||
led_activity.duty_u16(duty)
|
||||
sleep(0.0001)
|
Ładowanie…
Reference in New Issue