Shop OBEX P1 Docs P2 Docs Learn Events
Example Program - RGB Values — Parallax Forums

Example Program - RGB Values

Hi,
http://learn.parallax.com/tutorials/language/blocklyprop/oled-display-blocklyprop/using-rgb-color-values

OLED draw rectangle at (X) 10
(y) 10
width 70
height 40
roundnes 0
color color valur from:

this block don't work,
I get the error message

Compile... Failed!

compiler messages
Included libraries: colormath, simpletools, ssd1331
single.c: In function 'main':
single.c:35:48: error: invalid suffix "x" on integer constant
single.c:35:51: error: expected ')' before 'NaN'
single.c:35:51: error: too few arguments to function 'remapColor'
/opt/parallax/Workspace/Learn/Simple Libraries/Utility/libcolormath/colormath.h:86:5: note: declared here

is it a library problem?
how do i insert them?

thank you and greetings

Comments

  • PublisonPublison Posts: 12,366
    edited 2020-05-08 16:58
    Welcome to the forum!
    Are you using BlocklyProp or BlocklySolo? Are all you libraries up to date?
    What board are you selecting?
  • thanks for the welcome
    I ams using Blocklyprop, board is Propeller activity board, original, not WX.
    how do i know if the libraries are up to date?

    Best regards.
  • Please do build the project on Solo. Solo has the latest libraries and a few new and updated blocks that will no longer work in BlocklyProp. If the project fails to compile on Solo, please post the project file and we will take a look.
  • AutomaxionAutomaxion Posts: 26
    edited 2020-05-15 15:32
    I am having the same problem. I only use 'Solo'. I re-installed BlocklyProp Launcher (BPL) so I assume the libraries are up to date (no way of knowing as the BPL has no version shown). My OLED is working with other blocks. I tried a simple program as attached.

    Basically, the 'color value from' block does not work since if I change it to a 'Color [x]' where [x] is a square of actual color, it works and draws a square of the selected [x] color.

    The code is shown as being:

    //
    Libraries and Definitions
    #include "simpletools.h"
    #include "ssd1331.h"
    #include "colormath.h"

    //
    Global Variables and Objects
    screen *oledc;



    //
    Main Program
    int main() {
    oledc = ssd1331_init(17, 6, 5, 3, 2, 96, 64);
    fillRect(oledc, 0, 0, 96, 63, remapColor(0x NaN, "8R8G8B", "5R6G5B"));
    }


    When I tried to compile it I get:

    Compile... Failed!

    compiler messages
    Included libraries: ssd1331, simpletools, colormath
    single.c: In function 'main':
    single.c:14:44: error: invalid suffix "x" on integer constant
    single.c:14:47: error: expected ')' before 'NaN'
    single.c:14:47: error: too few arguments to function 'remapColor'
    /opt/parallax/simple-libraries/Learn/Simple Libraries/Utility/libcolormath/colormath.h:86:5: note: declared here
    undefined
    1588 x 1920 - 175K
  • It appears that the RemapColor block (color value from...) is not generating the correct C code. The problem is that the first argument is not evaluating correctly and is resolving to NaN (Not a Number). If you disable the block, the project compiles without error. I'll create an issue for this on GitHub.
    #include "simpletools.h"
    #include "ssd1331.h"
    #include "colormath.h"
    
    // ------ Global Variables and Objects ------
    screen *oledc;// ------ Libraries and Definitions ------
    
    
    
    
    // ------ Main Program ------
    int main() {
      oledc = ssd1331_init(17, 6, 5, 3, 2, 96, 64);
      fillRect(oledc, 0, 0, 96, 63, remapColor(0x NaN, "8R8G8B", "5R6G5B"));
    }
    
  • You can follow the issue on GitHub here
  • Thank-you Jim.
Sign In or Register to comment.