Quantcast
Channel: Support - Pimoroni Buccaneers
Viewing all articles
Browse latest Browse all 6857

Unicorn pHAT & Python - RainbowLamp project

$
0
0

@BlackSheep wrote:

Hello ! First thing first, i'm quite the noob concerning python. I'm making a little project for the imminent birthday of my sister and i'm trying to do a pretty thingy : a lamp. But one who does rainbow. (That's cool right ?)

So, that is what i wrote :

#!/usr/bin/env python

import colorsys
import time

import unicornhat as unicorn

print("Program starting...")

unicorn.set_layout(unicorn.PHAT)
unicorn.rotation(0)
unicorn.brightness(1)

unicorn.set_all(255, 0, 0)
unicorn.show()
time.sleep(60)
unicorn.set_all(255, 52, 0)
unicorn.show()
time.sleep(60)
unicorn.set_all(255, 178, 0)
unicorn.show()
time.sleep(60)
unicorn.set_all(232, 255, 0)
unicorn.show()
time.sleep(60)
unicorn.set_all(255, 52, 0)
unicorn.show()
time.sleep(60)
unicorn.set_all(255, 77, 0)
unicorn.show()
time.sleep(60)
unicorn.set_all(0, 255, 201)
unicorn.show()
time.sleep(60)
unicorn.set_all(0, 213, 255)
unicorn.show()
time.sleep(60)
unicorn.set_all(0, 125, 255)
unicorn.show()
time.sleep(60)
unicorn.set_all(4, 0, 255)
unicorn.show()
time.sleep(60)
unicorn.set_all(107, 0, 255)
unicorn.show()
time.sleep(60)
unicorn.set_all(235, 0, 255)
unicorn.show()
time.sleep(60)
unicorn.set_all(255, 0, 44)
unicorn.show()
time.sleep(60)

So... The rainbow, i kinda got it. But there is 0 smooth between colors (haven't figured out how to do transitions) and i don't really know how to make it loop. Can someone help me ? Thank you !

Posts: 7

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6857

Trending Articles