20 lines
592 B
C
20 lines
592 B
C
|
#include <FastLED.h>
|
||
|
|
||
|
//const String B64 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
|
||
|
const String B16 = "0123456789abcdef";
|
||
|
|
||
|
byte getBrightness(){
|
||
|
return map(analogRead(LIGHT_SENSOR_PIN),0,4095,15,255);
|
||
|
}
|
||
|
unsigned int cutcheck(unsigned int a, unsigned int b){
|
||
|
if(a==-1) return b;
|
||
|
if(b==-1) return a;
|
||
|
return min(a,b);
|
||
|
}
|
||
|
byte hextonum(String hex){
|
||
|
return (B16.indexOf(hex.substring(0,1))*16)+B16.indexOf(hex.substring(1,2));
|
||
|
}
|
||
|
CRGB hextocolor(String hex){
|
||
|
return CRGB(hextonum(hex.substring(0,2)),hextonum(hex.substring(2,4)),hextonum(hex.substring(4,6)));
|
||
|
}
|