//-------------------------------------------------------------------
// Konstanten:
const int PIN_RGB_ROT = 9;
const int PIN_LED_RGB_GRUEN = 6;
const int PIN_LED_RGB_BLAU = 10;
float x = 0;
//-------------------------------------------------------------------
void setup() {
Serial.begin(115200);
}
//-------------------------------------------------------------------
void loop() {
int tg_r = ((1 + sin(x + (0*2*PI/3))) / 2) * 255;
int tg_g = ((1 + sin(x + (1*2*PI/3))) / 2) * 255;
int tg_b = ((1 + sin(x + (2*2*PI/3))) / 2) * 255;
analogWrite(PIN_RGB_ROT, tg_r);
analogWrite(PIN_LED_RGB_GRUEN, tg_g);
analogWrite(PIN_LED_RGB_BLAU, tg_b);
x = x + 0.001;
Serial.print(x);
Serial.print(", ");
Serial.print(tg_r);
Serial.print(", ");
Serial.print(tg_g);
Serial.print(", ");
Serial.println(tg_b);
// Pause 250ms
delay(10);
}