Forever changing colors

Just wanted to share this code. This causes the RGB led to slowly change colors, that will never be the same. Using sine/cosine functions with prime numbers in the argument takes care of this. I should test the variable t for a maximum int and then loop backwards, but ok...
import pycom import math pycom.heartbeat(False) t = 0 f = 6.28/10000000. while 1: t+=1 red = 127 + int(127*math.sin(3*f*t)) green = 127 + int(127*math.cos(43*f*t)) blue = 127 + int(127*math.sin(127*f*t)) pycom.rgbled(red*256*256 + green*256 + blue)

@livius Thanks!

@zappfinger said in Forever changing colors:
I'm sorry, the 'Insert code block' does not seem to work for me or I use it wrongly...

I'm sorry, the 'Insert code block' does not seem to work for me or I use it wrongly...