Available for Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types. I/O pin availability will vary with board type.
The 96 x 64 Color OLED display module (#28087) [1] uses a coordinate grid to define where text, numbers, points, lines, and shapes can be drawn on the display module’s screen. The coordinates start at 0 (leftmost column), 0 (top row) and increase to 95 (rightmost column), 63 (bottom row).
See the OLED Display with BlocklyProp tutoria [2]l to get started.
WARNING! The OLED blocks can only be used from your main program. These blocks will not work if used inside function blocks that are then launched with the new processor block.
The OLED initialize block is used to set up the Color OLED display module. The DIN, CLK, CS, D/C, and RES pins on the module must be matched to the Propeller I/O pins they connect to.
If you have defined a constant using the constant define block, the constant will show up in all of the pin menus and can be selected instead of a numbered pin:
If you forget to use this block in your project, other OLED blocks will display a triangle warning symbol. Click the triangle, and you will see a reminder message to use the OLED initialize block at the beginning of your program.
The Display font loader block must be run as its own program, with no other blocks, before any medium or large fonts can be used. When this block is run, it takes about a minute to load all of the fonts onto the EEPROM memory chip on the Propeller Board.
The fonts are stored in EEPROM locations 40576..63400. This same block, using the same EEPROM locations, is also available from the ePaper menu.
The OLED max height block returns the vertical value of the bottom row of pixels: 63 when the pins are in a vertical orientation, 95 when the pins are in a horizontal orientation.
The OLED max width block returns the horizontal value of the rightmost column of pixels: 95 when the pins are in a vertical orientation, 63 when the pins are in a horizontal orientation.
The OLED command block permits you to choose and execute the command selected from the drop-down menu:
The OLED font color block is used to set both the color of the font and the background (highlight) color displayed behind the font characters. If the background color is set to the same color as the font color, the background will be made transparent.
The OLED set text block is used to set the size (small: 5x7, medium: 11x15, large: 17x23) and the font face (sans/console, serif/typewriter, script/handwriting, bubble/cartoon).
The OLED set cursor block sets the top left pixel position where the text is to begin next.
The OLED print text block is used to send text strings to the OLED module.
The OLED print number block is used to send numbers to the OLED module. Numbers can be displayed as a decimal, hexadecimal, or binary.
The OLED print multiple block can print several terms of different types on a single line. Click the gear icon to drag additional terms into the list, then attach appropriate values to the block. Options are:
Checking the Specify Digits block adds a fill-in field next to all attached number values.
Floating point number option
BlocklyProp uses integer numbers. The floating point number option allows an integer value to be displayed as a decimal number. Use its drop-down menu to divide the integer by a multiple of 10 to scale and display the number appropriately. The specify digits checkbox activates an additional field by each numeric term.
The OLED draw pixel block sets the pixel defined by the first two value blocks to the color defined by the color block.
The OLED draw line block draws a line from the first coordinate to the second coordinate in the color defined by the color block.
The OLED draw triangle block draws a triangle from the first coordinate to the second coordinate to the third coordinate in the color defined by the color block. The “fill” checkbox sets whether the triangle is drawn as hollow or filled.
The OLED draw rectangle block draws a rectangle from the first coordinate (top left corner of the rectangle) to the second coordinate (bottom right corner of the rectangle) in the color defined by the color block. The “roundness” value, if set to something other than zero, will round the corners by the amount specified (radius of the roundness). The “fill” checkbox sets whether the rectangle will be drawn as hollow or filled.
The OLED draw circle block will draw a circle whose center is set by the first two value blocks, and in the color defined by the color block. The “fill” checkbox sets whether the circle will be drawn as hollow or filled.
Displaying bitmap images from an SD card is SLOW! It will take approximately 20 seconds to draw a bitmap that fills the screen to the OLED module. Keep this in mind when designing your programs.
You can use OLED Bitmap blocks in the same program as WAV play [3] blocks. However, block order matters. The OLED Bitmap block lets go of the SD card file access automatically after fetching the image to be displayed. However, the WAV play [3] block does not. Use the WAV stop [3] block before trying to use an OLED Bitmap block, or just draw the image before starting the WAV player.
The OLED Bitmap block will draw a bitmap (BMP file format) saved on an SD card attached to the Propeller microcontroller. When using the board type for the Activity Board and Activity Board WX, which have built-in microSD card slots, the SD card is automatically initialized when this block is called. When using the FLiP or other board types, you will need to use the SD initialize [4] block at the beginning of your program.
The bitmap/BMP files meet the following requirements:
The online file converter https://image.online-convert.com [5]can create BMP files from nearly any kind of image. This online tool can also be used to resize the image to ensure that it will render correctly.
Links
[1] http://www.parallax.com/product/28087
[2] http://learn.parallax.com/tutorials/language/blocklyprop/oled-display-blocklyprop
[3] https://learn.parallax.com/ab-blocks/audio
[4] https://learn.parallax.com/ab-blocks/memory
[5] https://image.online-convert.com/convert-to-bmp