
Sense.show_message("One small step for Pi!", text_colour=)ĭisplays a single text character on the LED matrix. Each R-G-B element must be an integer between 0 and 255. Defaults to white.Ī list containing the R-G-B (red, green, blue) colour of the background. Defaults to 0.1Ī list containing the R-G-B (red, green, blue) colour of the text. This value represents the time paused for between shifting the text to the left by one column of pixels. The speed at which the text should scroll. Scrolls a text message from right to left across the LED matrix and at the specified speed, in the specified colour and background colour. Sense.clear(255, 255, 255) # passing in r, g and b values of a colour Sense.clear(red) # passing in an RGB tuple Sense.clear() # no arguments defaults to off Defaults to (0, 0, 0).Īlternatively, the RGB values can be passed individually: Each element must be an integer between 0 and 255. ParameterĪ tuple or list containing the RGB (red, green, blue) values of the colour. Sets the entire LED matrix to a single colour, defaults to blank / off. Invader_pixels = sense.load_image("space_invader.png", redraw=False) Defaults to TrueĪ list containing 64 smaller lists of pixels (red, green, blue) representing the loaded image after RGB conversion. Whether or not to redraw the loaded image file on the LED matrix. The file system path to the image file to load. Loads an image file, converts it to RGB format and displays it on the LED matrix. Note: Please read the note under get_pixels Returns a list of representing the colour of an individual LED matrix pixel at the specified X-Y coordinate. Or three separate values for red, green and blue: ParameterĬolour can either be passed as an RGB tuple:Įach element must be an integer between 0 and 255. Sets an individual LED matrix pixel at the specified X-Y coordinate to the specified colour. The get_pixels function provides a correct representation of how the pixels end up in frame buffer memory after you've called set_pixels. The loss of binary precision when performing this conversion (3 bits lost for red, 2 for green and 3 for blue) accounts for the discrepancies you see. 5 bits for red, 6 bits for green and 5 bits for blue. This is because we specify each pixel element as 8 bit numbers (0 to 255) but when they're passed into the Linux frame buffer for the LED matrix the numbers are bit shifted down to fit into RGB 565. Note: You will notice that the pixel values you pass into set_pixels sometimes change when you read them back with get_pixels. Each R-G-B element must be an integer between 0 and 255.Ī list containing 64 smaller lists of pixels (red, green, blue) representing the currently displayed image. ParameterĪ list containing 64 smaller lists of pixels (red, green, blue). Updates the entire LED matrix based on a 64 length list of pixel values. Whether or not to redraw what is already being displayed on the LED matrix when flipped. ParameterĪ list containing 64 smaller lists of pixels (red, green, blue) representing the flipped image.įlips the image on the LED matrix vertically. Defaults to Trueįlips the image on the LED matrix horizontally. Whether or not to redraw what is already being displayed on the LED matrix. 0 is with the Raspberry Pi HDMI port facing downwards. The angle to rotate the LED matrix though. If you're using the Pi upside down or sideways you can use this function to correct the orientation of the image being shown. Sense HAT API Reference LED Matrix set_rotation
