LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Allocate integer numbers to colors

I have color boxes that I want to change color due to an decimal number input (64 bit)  where I am getting numbers 0-1024

 

If I convert the number to hex they come out mostly black. Is there a way that I can have a sort of if/then thing going on that allocates each number to a certain color?

 

I would like to have a gradient fron red to blue that corresponds to the 0-1024 numbers

 

I attached the VI that I'm working with, its the bottom most part inside the while loop, I also attached the CSV txt file that goes with it  

 

Thanks! 

Download All
0 Kudos
Message 1 of 4
(3,841 Views)

Ok, I posted some code (deleted) before looking at the text file. Why are you using 64 bit integer?

 

Anyway, if you know the maximum value the sensor will provide, you can do something like this (using 16 bit integers):

 

colormap.png 

 

Message 2 of 4
(3,836 Views)

Thanks so much! 

This does work, even with the 64 biit. I'm not exactly sure why it's that way but I working on this as part of a group project and that is what some other guy gave me. 

Is there a way to make it go through the green to? Like from blue to green to red?

 

Much appreciated. Smiley Happy

0 Kudos
Message 3 of 4
(3,803 Views)

Look at the help for the RGB to Color.vi and try a few things to see how they work. You have three inputs ranging from 0 to 255 to give you the total range of colors which cna be generated in LV.  You need to decide how to map the values of your signal into those three color components.

 

Lynn

Message 4 of 4
(3,799 Views)