How should I do base 10 to base 16 integer conversion in Squirrel? In Javascript I can do this with: parseInt("ff", 16)
.
I'm trying to do a HEX color code to RGB calculator for an Electric Imp. #ffaacc
would be split into 3 parts (ff
, aa
and cc
). I would then calculate these to base 10 integers and achieve RGB(255, 170, 204). These numbers I will then use to control an RGB led with PWM.
Here's one approach using array.find (and format for reversal):