Prequel
primitive recursive driven programming


Blinkp

Blinkp is an unofficial Prequel simulator of Pimoroni's Blinkt! — a Raspberry Pi add-on with 8 RGB LEDs.
Create and run simple animations while honing your Prequel skills.

Run Pause Stop
Runtime Error: DIVISION BY ZERO
0
0
0
← calls
← instructions
← memory (max use: 0)

Prequel program

Edit Save Load Debug
Parser Error: UNEXPECTED CHAR

Module: blinkp

blinkp.clear()
blinkp.show_and_exit()

Input:

blinkp.num_pixels
 Total number of pixels.
 -> 8
 This value is constant.
blinkp.elapsed_time
 Total number of seconds elapsed since the beginning of program execution.

Functions:

r, g, b, brightness? = blinkp.get_pixel(index)
 Get RGB values and brightness of the pixel at index.
 The brightness return variable is optional.
 -> r: integer between 0 and 255
 -> g: integer between 0 and 255
 -> b: integer between 0 and 255
 -> brightness: number between 0.0 and 1.0
 -> index: integer between 0 and blinkp.num_pixels-1
blinkp.set_pixel(index, r, g, b, brightness?)
 Set pixel at index with RGB values r g b and the specified brightness.
 The brightness argument is optional; if not used, it keeps the previous value.
 -> index: integer between 0 and blinkp.num_pixels-1
 -> r: integer between 0 and 255
 -> g: integer between 0 and 255
 -> b: integer between 0 and 255
 -> brightness: number between 0.0 and 1.0
 Changes take effect after the next call to
  blinkp.show_and_wait or blinkp.show_and_exit.
blinkp.clear()
 Shorthand for blinkp.set_all(0, 0, 0).
blinkp.set_all(r, g, b, brightness?)
 Equivalent to calling blinkp.set_pixel for all pixels:
  blinkp.set_pixel(0, r, g, b, brightness?)
  blinkp.set_pixel(1, r, g, b, brightness?)
  ...
  blinkp.set_pixel(blinkp.num_pixels-1, r, g, b, brightness?)
blinkp.set_brightness(brightness)
 Set the brightness value of all pixels to brightness.
 -> brightness: number between 0.0 and 1.0
 Changes take effect after the next call to
  blinkp.show_and_wait or blinkp.show_and_exit.
blinkp.show_and_wait(milliseconds)
 Commit changes to the display and wait the specified milliseconds
  before continuing execution by restarting the program counter.
blinkp.show_and_exit()
 Commit changes to the display and halt the program.
y, i, q = blinkp.rgb_to_yiq(r, g, b)
r, g, b = blinkp.yiq_to_rgb(y, i, q)
h, l, s = blinkp.rgb_to_hls(r, g, b)
r, g, b = blinkp.hls_to_rgb(h, l, s)
h, s, v = blinkp.rgb_to_hsv(r, g, b)
r, g, b = blinkp.hsv_to_rgb(h, s, v)
 Convert values between different color spaces.

Available examples: