Skip to content

Instantly share code, notes, and snippets.

@izikeros
Created March 10, 2023 07:25
Show Gist options
  • Select an option

  • Save izikeros/03576a105df4051da26d4fd69b87e8e4 to your computer and use it in GitHub Desktop.

Select an option

Save izikeros/03576a105df4051da26d4fd69b87e8e4 to your computer and use it in GitHub Desktop.
Konspekt przeprowadzenia AstroPi misja zero
  • Login: https://missions.astro-pi.org/login
  • zmienić jezyk na polski
  • pokaz i nauka wybierania kolorów - RGB
  • wybór obrazka Copy-paste (ewentualna zmiana wybranych kolorów)
  • ustawianie tła, c- to kolor tła
  • nie sprawdza koloru co chwilę
    • dodać sprawdzanie w pętli + `sleep(1)``
    • wcięcia!
  • czyszczenie ekranu na koniec programu:
    • sense.clear()
  • Wybór nazwy zespołu
  • Wysłanie zgłoszenia
    • classroom code z maila z tytułem: Thank you for registering as a mentor for Astro Pi Mission Zero
rgb = sense.color # get the colour from the sensor
c = (rgb.red, rgb.green, rgb.blue)
# Import the libraries
from sense_hat import SenseHat
from time import sleep

# Set up the Sense HAT
sense = SenseHat()
sense.set_rotation(270)

# Set up the colour sensor
sense.color.gain = 60 # Set the sensitivity of the sensor
sense.color.integration_cycles = 64 # The interval at which the reading will be taken

# Add colour variables and image

c = (0, 0, 0) # Black
m = (34, 139, 34) # ForestGreen
q = (255, 255, 0) # Yellow
t = (255, 140, 0) # DarkOrange
y = (255, 20, 147) # DeepPink

for i in range(28):
  rgb = sense.color # get the colour from the sensor
  c = (rgb.red, rgb.green, rgb.blue)

  image = [
    c, c, y, y, y, y, c, c,
    c, y, y, t, t, y, y, c,
    y, y, t, q, q, t, y, y,
    c, y, y, t, t, y, y, c,
    c, c, y, y, y, y, c, c,
    m, c, c, m, m, c, c, m,
    c, m, m, m, m, m, m, c,
    c, c, c, m, m, c, c, c]

  # Display the image

  sense.set_pixels(image)
  sleep(1)

x = (178, 34, 34)  # choose your own red, green, blue values between 0 - 255
sense.clear(x)
# zmiana wybranego koloru (istniejęcego lub wprowadzenie nowego)
if i % 2:
  ą = (0, 0, 0)
else:
  ą = (200, 200, 200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment