Merge pull request #585 from pimoroni/hel-fix-graph

correct sine wave in calc.py
pull/587/head
Hel Gibbons 2022-11-23 16:46:52 +00:00 zatwierdzone przez GitHub
commit 993609342e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 15 dodań i 3 usunięć

Wyświetl plik

@ -137,4 +137,6 @@ Here are some cool Galactic Unicorn community projects and resources that you mi
- :link: [Galactic Unicorn MQTT scroller (and 3D printed case)](https://github.com/ucl-casa-ce/Galactic-Unicorn-MQTT-Scroller)
- :link: [Compiling custom pimoroni-pico MicroPython (with ulab)](https://medium.com/@iestynlloyd/galactic-unicorns-and-custom-pimoroni-pico-firmware-38dd7c5913b8)
- :link: [Galactic Unicorn Graphical Workout](https://www.instructables.com/Galactic-Unicorn-Graphical-Workout/)
- :link: [Cheerlights + Galactic Unicorn + MicroPython (beginner-friendly tutorial)](https://cheerlights.com/cheerlights-raspberry-pi-pico-w-micropython/)
- :link: [Galactic Unicorn Bounce - Simple GFX Demo](https://www.instructables.com/Galactic-Unicorn-Bounce-Simple-GFX-Demo/)
- :link: [Cheerlights + Galactic Unicorn + MicroPython (beginner-friendly tutorial)](https://cheerlights.com/cheerlights-raspberry-pi-pico-w-micropython/)
- :link: [CheerClock (plus laser-cut templates for a fancy case/diffuser)](https://github.com/seanosteen/CheerClock)

Wyświetl plik

@ -26,7 +26,7 @@ def draw_axis():
def draw_sine(offset=0, vlines=False):
for x in range(128):
angle = 720 / 128 * x
y = int((sin(radians(angle + offset)) * 24) + 32)
y = int(32 - (sin(radians(angle + offset)) * 24))
display.pixel(x, y)
if vlines:
if x % 2 == 0:
@ -35,7 +35,10 @@ def draw_sine(offset=0, vlines=False):
def draw_text():
display.text("Remember A-Level Maths!", 0, 0, WIDTH, 1)
display.text("y=sin(x) x=(-360:360)", 0, 58, WIDTH, 1)
display.text("y = sin(x)", 0, HEIGHT - 6, scale=1)
# measure this text so we can right orientate it
textwidth = display.measure_text("x = -360°:360°", scale=1)
display.text("x = -360°:360°", WIDTH - textwidth, HEIGHT - 6, scale=1)
# Clear display

Wyświetl plik

@ -18,6 +18,7 @@
- [Wireless Examples](#wireless-examples)
- [Cheerlights](#cheerlights)
- [Weather](#weather)
- [Other Resources](#other-resources)
## About Plasma Stick
@ -152,3 +153,9 @@ Find out more about the Cheerlights API at [https://cheerlights.com/].
This Plasma Stick example connects to Open Meteo to access the current weather conditions.
It then does some cool weather appropriate stuff with LEDs.
Find out more about the Open Meteo API at [https://open-meteo.com].
## Other Resources
Here are some Plasma Stick community projects and resources that you might find useful! Note that code at the links below has not been tested by us and we're not able to offer support with it.
- :link: [MQTT Script for Plasma Stick](https://github.com/digitalurban/MQTT-Plasma-Stick-2040W)