Im coding a messaging system for my screen, serial, or web UI.
I want to pass a string ("like brightness up") and the current 'integer' value of brightness.
For the life of me seem impossible...
Can you help me find what im doing wrong?
#include <stdio.h>
#include <string.h>
//uint8_t brightness = 50;
int brightness = 50;
void brightnessDown(){
if (brightness>0) brightness --;
// this will not compile
char tmp[] = "Brightness Down";
// char tmp2 = brightness;
char tmp2 = brightness+0; // tip i saw somewhere
char tmp2 = (char) brightness+0; // same result
char tmp2[] = (char) brightness;
char tmp2 = (const char) brightness;
i tried all the wrong sugar to get this to work...
// this does not want to compile
strcat(tmp,tmp2);
// showDisplay(&tmp);
// showDisplayln(tmp);
// this compiles
Serial.print("brightness: ");
Serial.println(brightness);
// this will not compile
// char bri = (char) brightness;
//showDisplay(bri);
// showDisplay(strcat("brightness:",bri));
FastLED.setBrightness(brightness);
}
void showDisplay(char *txt)
{
lcd.print(txt);
Serial.print(txt);
Heltec.display->clear();
Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
Heltec.display->setFont(ArialMT_Plain_10);
Heltec.display->drawString(0, 0, txt);
}
// This works
void whatever(int x){
...
case 7:
currentPalette = RainbowColors_p;
showDisplay("Palette: RainbowColors_p");
break;
}