Skip to content

Instantly share code, notes, and snippets.

@simonbyrne
Last active November 1, 2016 01:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save simonbyrne/4e476bcfb79216c3220b877c6d2bbe32 to your computer and use it in GitHub Desktop.
Save simonbyrne/4e476bcfb79216c3220b877c6d2bbe32 to your computer and use it in GitHub Desktop.
For my Raspberry Pi powered jack-o'-lantern
using SenseHat
import SenseHat: RGB565
function spooky(decay, arriv, refresh)
x = rand()
while true
x *= exp(-decay*refresh)
if rand() < arriv*refresh
x += (1-x)*rand()
end
led_display([RGB565(x,0,0) for i = 1:8, j = 1:8])
end
sleep(refresh)
end
spooky(0.2,0.1,0.01)
@simonbyrne
Copy link
Author

simonbyrne commented Oct 31, 2016

@Keno
Copy link

Keno commented Oct 31, 2016

Should the sleep be inside the loop?

@simonbyrne
Copy link
Author

simonbyrne commented Oct 31, 2016

Should the sleep be inside the loop?

Good catch!

Seemed to get a good effect without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment