Skip to main content
deleted 15 characters in body; edited title
Source Link
dda
  • 1.6k
  • 1
  • 12
  • 18

Arduino yunYun not showing anything on the serial monitor

I am having issues with the arduino yun,ArduinoYun. It's not showing any data in the serial monitor. The sensor lights up when iI plug it in but that isthat's about it and the code seems to compile but nothing is coming through. I am using the adafruitAdafruit color sensor. iI have the sda and slcSDA/SCL connected to pinpins 4 and 5. theThe servo is connected to pin 3. theThe rest is just on Vin and GND.

   #include "Servo.h"
   #include "Wire.h"
   #include "Adafruit_TCS34725.h"

 const int redPos = 160;
 const int orangePos = 130;
 const int yellowPos = 100;
 const int greenPos = 70;
 const int bluePos = 30;
 const int nonePos = 0; // Kein Objekt erkannt

  Servo myservo;

Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X);

void setup() {
 
  Serial.begin(9600);
  Serial.println("Makerblog.at - MuMs Color Sensor");
 
  if (tcs.begin()) {
    Serial.println("Sensor gefunden");
  } else {
    Serial.println("TCS34725 nicht gefunden ... Ablauf gestoppt!");
  while (1); 
         } 

  // Der Servo hängt am PWM-Pin 3 
  myservo.attach(3);
  // Servo in Grundstellung fahren
  myservo.write(0);
  delay(1000);
 
 }

 void loop() {
 
  uint16_t clearcol, red, green, blue;
  float average, r, g, b;
  delay(100); // Farbmessung dauert c. 50ms 
  tcs.getRawData(&red, &green, &blue, &clearcol);

 
  average = (red+green+blue)/3;
  r = red/average;
  g = green/average;
  b = blue/average;

  // Clear-Wert und r,g,b seriell ausgeben zur Kontrolle
  // r,g und b sollten sich ca. zwischen 0,5 und 1,5 
  // bewegen. Sieht der Sensor rot, dann sollte r deutlich über 1.0
  // liegen, g und b zwischen 0.5 und 1.0 usw.
  Serial.print("\tClear:"); Serial.print(clearcol);
  Serial.print("\tRed:"); Serial.print(r);
  Serial.print("\tGreen:"); Serial.print(g);
  Serial.print("\tBlue:"); Serial.print(b);

  if ((r > 1.4) && (g < 0.9) && (b < 0.9)) {
    Serial.print("\tROT");
    myservo.write(redPos);
  }
  else if ((r < 0.95) && (g > 1.4) && (b < 0.9)) {
    Serial.print("\tGRUEN");
    myservo.write(greenPos);
  }
  else if ((r < 0.8) && (g < 1.2) && (b > 1.2)) {
    Serial.print("\tBLAU");
    myservo.write(bluePos);
 }

 } else if ((r > 1.15) && (g > 1.15) && (b < 0.7)) {
    Serial.print("\tGELB");
    myservo.write(yellowPos);
   }
  else if ((r > 1.4) && (g < 1.0) && (b < 0.7)) {
    Serial.print("\tORANGE");
    myservo.write(orangePos);
  } 
  else {
    Serial.print("\tNICHT ERKANNT"); 
    myservo.write(nonePos);
   }

 
  Serial.println("");
 
  delay(100);

Arduino yun not showing anything on the serial monitor

I am having issues with the arduino yun, showing any data in the serial monitor. The sensor lights up when i plug it in but that is about it and the code seems to compile but nothing is coming through. I am using the adafruit color sensor. i have the sda and slc connected to pin 4 and 5. the servo is connected to pin 3. the rest is just on Vin and GND.

   #include "Servo.h"
   #include "Wire.h"
   #include "Adafruit_TCS34725.h"

 const int redPos = 160;
 const int orangePos = 130;
 const int yellowPos = 100;
 const int greenPos = 70;
 const int bluePos = 30;
 const int nonePos = 0; // Kein Objekt erkannt

  Servo myservo;

Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X);

void setup() {
 
Serial.begin(9600);
Serial.println("Makerblog.at - MuMs Color Sensor");
 
 if (tcs.begin()) {
 Serial.println("Sensor gefunden");
 } else {
 Serial.println("TCS34725 nicht gefunden ... Ablauf gestoppt!");
 while (1); 
         } 

 // Der Servo hängt am PWM-Pin 3 
 myservo.attach(3);
// Servo in Grundstellung fahren
myservo.write(0);
delay(1000);
 
 }

 void loop() {
 
uint16_t clearcol, red, green, blue;
 float average, r, g, b;
 delay(100); // Farbmessung dauert c. 50ms 
tcs.getRawData(&red, &green, &blue, &clearcol);

 
average = (red+green+blue)/3;
r = red/average;
g = green/average;
b = blue/average;

// Clear-Wert und r,g,b seriell ausgeben zur Kontrolle
// r,g und b sollten sich ca. zwischen 0,5 und 1,5 
// bewegen. Sieht der Sensor rot, dann sollte r deutlich über 1.0
// liegen, g und b zwischen 0.5 und 1.0 usw.
Serial.print("\tClear:"); Serial.print(clearcol);
Serial.print("\tRed:"); Serial.print(r);
Serial.print("\tGreen:"); Serial.print(g);
Serial.print("\tBlue:"); Serial.print(b);

 if ((r > 1.4) && (g < 0.9) && (b < 0.9)) {
  Serial.print("\tROT");
  myservo.write(redPos);
  }
  else if ((r < 0.95) && (g > 1.4) && (b < 0.9)) {
 Serial.print("\tGRUEN");
 myservo.write(greenPos);
}
  else if ((r < 0.8) && (g < 1.2) && (b > 1.2)) {
 Serial.print("\tBLAU");
 myservo.write(bluePos);
 }

  else if ((r > 1.15) && (g > 1.15) && (b < 0.7)) {
  Serial.print("\tGELB");
  myservo.write(yellowPos);
   }
  else if ((r > 1.4) && (g < 1.0) && (b < 0.7)) {
  Serial.print("\tORANGE");
  myservo.write(orangePos);
  } 
  else {
  Serial.print("\tNICHT ERKANNT"); 
  myservo.write(nonePos);
   }

 
 Serial.println("");
 
delay(100);

Arduino Yun not showing anything on the serial monitor

I am having issues with the ArduinoYun. It's not showing any data in the serial monitor. The sensor lights up when I plug it in but that's about it and the code seems to compile but nothing is coming through. I am using the Adafruit color sensor. I have SDA/SCL connected to pins 4 and 5. The servo is connected to pin 3. The rest is just on Vin and GND.

#include "Servo.h"
#include "Wire.h"
#include "Adafruit_TCS34725.h"

const int redPos = 160;
const int orangePos = 130;
const int yellowPos = 100;
const int greenPos = 70;
const int bluePos = 30;
const int nonePos = 0; // Kein Objekt erkannt

Servo myservo;

Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X);

void setup() {
  Serial.begin(9600);
  Serial.println("Makerblog.at - MuMs Color Sensor");
  if (tcs.begin()) {
    Serial.println("Sensor gefunden");
  } else {
    Serial.println("TCS34725 nicht gefunden ... Ablauf gestoppt!");
  while (1); 
  }
  // Der Servo hängt am PWM-Pin 3
  myservo.attach(3);
  // Servo in Grundstellung fahren
  myservo.write(0);
  delay(1000);
}

void loop() {
  uint16_t clearcol, red, green, blue;
  float average, r, g, b;
  delay(100); // Farbmessung dauert c. 50ms
  tcs.getRawData(&red, &green, &blue, &clearcol);
  average = (red+green+blue)/3;
  r = red/average;
  g = green/average;
  b = blue/average;

  // Clear-Wert und r,g,b seriell ausgeben zur Kontrolle
  // r,g und b sollten sich ca. zwischen 0,5 und 1,5
  // bewegen. Sieht der Sensor rot, dann sollte r deutlich über 1.0
  // liegen, g und b zwischen 0.5 und 1.0 usw.
  Serial.print("\tClear:"); Serial.print(clearcol);
  Serial.print("\tRed:"); Serial.print(r);
  Serial.print("\tGreen:"); Serial.print(g);
  Serial.print("\tBlue:"); Serial.print(b);

  if ((r > 1.4) && (g < 0.9) && (b < 0.9)) {
    Serial.print("\tROT");
    myservo.write(redPos);
  } else if ((r < 0.95) && (g > 1.4) && (b < 0.9)) {
    Serial.print("\tGRUEN");
    myservo.write(greenPos);
  } else if ((r < 0.8) && (g < 1.2) && (b > 1.2)) {
    Serial.print("\tBLAU");
    myservo.write(bluePos);
  } else if ((r > 1.15) && (g > 1.15) && (b < 0.7)) {
    Serial.print("\tGELB");
    myservo.write(yellowPos);
  } else if ((r > 1.4) && (g < 1.0) && (b < 0.7)) {
    Serial.print("\tORANGE");
    myservo.write(orangePos);
  } else {
    Serial.print("\tNICHT ERKANNT");
    myservo.write(nonePos);
  }
  Serial.println("");
  delay(100);
update on progress
Source Link

color sensor code arduino Arduino yun not showing anything on the serial monitor

All this code does is detect a color then rotates toI am having issues with the corresponding color onarduino yun, showing any data in the color wheel using a servoserial monitor. I want to change the colors whichThe sensor lights up when i am guessing would not be too hard. My question for nowplug it in but that is, how does this code tell about it and the servo to rotatecode seems to compile but nothing is coming through. I am using the correct position after it has detected a certainadafruit color sensor. I believe all i have to do is add one more else if statement then change the color rangesda and slc connected to what i want, But i am not sure i would account for that with the positions forpin 4 and 5. the servo is connected to pin 3. the rest is just on Vin and GND.

// Libraries einbinden
   #include "Servo.h"
   #include "Wire.h"
   #include "Adafruit_TCS34725.h"

// Servo-Positionen in Grad für Farben, bitte anpassen
 const int redPos = 160;
 const int orangePos = 130;
 const int yellowPos = 100;
 const int greenPos = 70;
 const int bluePos = 30;
 const int nonePos = 0; // Kein Objekt erkannt

 // Servo-Objekt initialisieren
  Servo myservo;

// Color Sensor-Objekt initialisieren
// Parameter siehe: https://learn.adafruit.com/adafruit-color-sensors/program-it
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X);

 // setup() wird einmal beim Start des Arduino ausgeführt
void setup() {
 
// Serielle Kommunikation zur Ausgabe der Wert im seriellen Monitor
Serial.begin(9600);
Serial.println("Makerblog.at - MuMs Color Sensor");

 // Überprüfen, ob Color Sensor sich auch zurückmeldet
 if (tcs.begin()) {
 // Alles OK
 Serial.println("Sensor gefunden");
 } else {
 // Kein Sensor gefunden. Programm an dieser Stelle einfrieren
 Serial.println("TCS34725 nicht gefunden ... Ablauf gestoppt!");
 while (1); // Halt!
         } 

 // Der Servo hängt am PWM-Pin 3 
 myservo.attach(3);
// Servo in Grundstellung fahren
myservo.write(0);
delay(1000);

 }

 // loop() wird wiederholt, solange der Arduino läuft
 void loop() {
 
 // Der Sensor liefert Werte für R, G, B und einen Clear-Wert zurück
uint16_t clearcol, red, green, blue;
 float average, r, g, b;
 delay(100); // Farbmessung dauert c. 50ms 
tcs.getRawData(&red, &green, &blue, &clearcol);

// Mein Versuch einer Farbbestimmung für 
// die 5 M&M-Farben Rot, Grün, Blau, Orange und Gelb

// Durchschnitt von RGB ermitteln
average = (red+green+blue)/3;
// Farbwerte durch Durchschnitt, 
// alle Werte bewegen sich jetzt rund um 1 
r = red/average;
g = green/average;
b = blue/average;

// Clear-Wert und r,g,b seriell ausgeben zur Kontrolle
// r,g und b sollten sich ca. zwischen 0,5 und 1,5 
// bewegen. Sieht der Sensor rot, dann sollte r deutlich über 1.0
// liegen, g und b zwischen 0.5 und 1.0 usw.
Serial.print("\tClear:"); Serial.print(clearcol);
Serial.print("\tRed:"); Serial.print(r);
Serial.print("\tGreen:"); Serial.print(g);
Serial.print("\tBlue:"); Serial.print(b);

 // Versuch der Farbfeststellung anhand der r,g,b-Werte.
 // Am besten mit Rot, Grün, Blau anfangen die die Schwellenwerte
 // mit der seriellen Ausgabe entsprechend anpassen
 if ((r > 1.4) && (g < 0.9) && (b < 0.9)) {
  Serial.print("\tROT");
  myservo.write(redPos);
  }
 else if ((r < 0.95) && (g > 1.4) && (b < 0.9)) {
 Serial.print("\tGRUEN");
 myservo.write(greenPos);
}
 else if ((r < 0.8) && (g < 1.2) && (b > 1.2)) {
 Serial.print("\tBLAU");
 myservo.write(bluePos);
 }
 // Gelb und Orange sind etwas tricky, aber nach etwas
 // Herumprobieren haben sich bei mir diese Werte als
 // gut erwiesen
  else if ((r > 1.15) && (g > 1.15) && (b < 0.7)) {
  Serial.print("\tGELB");
  myservo.write(yellowPos);
   }
  else if ((r > 1.4) && (g < 1.0) && (b < 0.7)) {
  Serial.print("\tORANGE");
  myservo.write(orangePos);
  } 
  // Wenn keine Regel greift, dann ehrlich sein
  else {
  Serial.print("\tNICHT ERKANNT"); 
  // myservo.write(nonePos);
   }
 

 // Zeilenwechsel ausgeben
 Serial.println("");
 
// Wartezeit anpassen für serielles Debugging
delay(100);

color sensor code arduino

All this code does is detect a color then rotates to the corresponding color on the color wheel using a servo. I want to change the colors which i am guessing would not be too hard. My question for now is, how does this code tell the servo to rotate to the correct position after it has detected a certain color. I believe all i have to do is add one more else if statement then change the color range to what i want, But i am not sure i would account for that with the positions for the servo.

// Libraries einbinden
   #include "Servo.h"
   #include "Wire.h"
   #include "Adafruit_TCS34725.h"

// Servo-Positionen in Grad für Farben, bitte anpassen
 const int redPos = 160;
 const int orangePos = 130;
 const int yellowPos = 100;
 const int greenPos = 70;
 const int bluePos = 30;
 const int nonePos = 0; // Kein Objekt erkannt

 // Servo-Objekt initialisieren
  Servo myservo;

// Color Sensor-Objekt initialisieren
// Parameter siehe: https://learn.adafruit.com/adafruit-color-sensors/program-it
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X);

 // setup() wird einmal beim Start des Arduino ausgeführt
void setup() {
 
// Serielle Kommunikation zur Ausgabe der Wert im seriellen Monitor
Serial.begin(9600);
Serial.println("Makerblog.at - MuMs Color Sensor");

 // Überprüfen, ob Color Sensor sich auch zurückmeldet
 if (tcs.begin()) {
 // Alles OK
 Serial.println("Sensor gefunden");
 } else {
 // Kein Sensor gefunden. Programm an dieser Stelle einfrieren
 Serial.println("TCS34725 nicht gefunden ... Ablauf gestoppt!");
 while (1); // Halt!
         } 

 // Der Servo hängt am PWM-Pin 3 
 myservo.attach(3);
// Servo in Grundstellung fahren
myservo.write(0);
delay(1000);

 }

 // loop() wird wiederholt, solange der Arduino läuft
 void loop() {
 
 // Der Sensor liefert Werte für R, G, B und einen Clear-Wert zurück
uint16_t clearcol, red, green, blue;
 float average, r, g, b;
 delay(100); // Farbmessung dauert c. 50ms 
tcs.getRawData(&red, &green, &blue, &clearcol);

// Mein Versuch einer Farbbestimmung für 
// die 5 M&M-Farben Rot, Grün, Blau, Orange und Gelb

// Durchschnitt von RGB ermitteln
average = (red+green+blue)/3;
// Farbwerte durch Durchschnitt, 
// alle Werte bewegen sich jetzt rund um 1 
r = red/average;
g = green/average;
b = blue/average;

// Clear-Wert und r,g,b seriell ausgeben zur Kontrolle
// r,g und b sollten sich ca. zwischen 0,5 und 1,5 
// bewegen. Sieht der Sensor rot, dann sollte r deutlich über 1.0
// liegen, g und b zwischen 0.5 und 1.0 usw.
Serial.print("\tClear:"); Serial.print(clearcol);
Serial.print("\tRed:"); Serial.print(r);
Serial.print("\tGreen:"); Serial.print(g);
Serial.print("\tBlue:"); Serial.print(b);

 // Versuch der Farbfeststellung anhand der r,g,b-Werte.
 // Am besten mit Rot, Grün, Blau anfangen die die Schwellenwerte
 // mit der seriellen Ausgabe entsprechend anpassen
 if ((r > 1.4) && (g < 0.9) && (b < 0.9)) {
  Serial.print("\tROT");
  myservo.write(redPos);
  }
 else if ((r < 0.95) && (g > 1.4) && (b < 0.9)) {
 Serial.print("\tGRUEN");
 myservo.write(greenPos);
}
 else if ((r < 0.8) && (g < 1.2) && (b > 1.2)) {
 Serial.print("\tBLAU");
 myservo.write(bluePos);
 }
 // Gelb und Orange sind etwas tricky, aber nach etwas
 // Herumprobieren haben sich bei mir diese Werte als
 // gut erwiesen
  else if ((r > 1.15) && (g > 1.15) && (b < 0.7)) {
  Serial.print("\tGELB");
  myservo.write(yellowPos);
   }
  else if ((r > 1.4) && (g < 1.0) && (b < 0.7)) {
  Serial.print("\tORANGE");
  myservo.write(orangePos);
  } 
  // Wenn keine Regel greift, dann ehrlich sein
  else {
  Serial.print("\tNICHT ERKANNT"); 
  // myservo.write(nonePos);
   }
 

 // Zeilenwechsel ausgeben
 Serial.println("");
 
// Wartezeit anpassen für serielles Debugging
delay(100);

Arduino yun not showing anything on the serial monitor

I am having issues with the arduino yun, showing any data in the serial monitor. The sensor lights up when i plug it in but that is about it and the code seems to compile but nothing is coming through. I am using the adafruit color sensor. i have the sda and slc connected to pin 4 and 5. the servo is connected to pin 3. the rest is just on Vin and GND.

   #include "Servo.h"
   #include "Wire.h"
   #include "Adafruit_TCS34725.h"

 const int redPos = 160;
 const int orangePos = 130;
 const int yellowPos = 100;
 const int greenPos = 70;
 const int bluePos = 30;
 const int nonePos = 0; // Kein Objekt erkannt

  Servo myservo;

Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X);

void setup() {

Serial.begin(9600);
Serial.println("Makerblog.at - MuMs Color Sensor");

 if (tcs.begin()) {
 Serial.println("Sensor gefunden");
 } else {
 Serial.println("TCS34725 nicht gefunden ... Ablauf gestoppt!");
 while (1); 
         } 

 // Der Servo hängt am PWM-Pin 3 
 myservo.attach(3);
// Servo in Grundstellung fahren
myservo.write(0);
delay(1000);

 }

 void loop() {

uint16_t clearcol, red, green, blue;
 float average, r, g, b;
 delay(100); // Farbmessung dauert c. 50ms 
tcs.getRawData(&red, &green, &blue, &clearcol);


average = (red+green+blue)/3;
r = red/average;
g = green/average;
b = blue/average;

// Clear-Wert und r,g,b seriell ausgeben zur Kontrolle
// r,g und b sollten sich ca. zwischen 0,5 und 1,5 
// bewegen. Sieht der Sensor rot, dann sollte r deutlich über 1.0
// liegen, g und b zwischen 0.5 und 1.0 usw.
Serial.print("\tClear:"); Serial.print(clearcol);
Serial.print("\tRed:"); Serial.print(r);
Serial.print("\tGreen:"); Serial.print(g);
Serial.print("\tBlue:"); Serial.print(b);

 if ((r > 1.4) && (g < 0.9) && (b < 0.9)) {
  Serial.print("\tROT");
  myservo.write(redPos);
  }
 else if ((r < 0.95) && (g > 1.4) && (b < 0.9)) {
 Serial.print("\tGRUEN");
 myservo.write(greenPos);
}
 else if ((r < 0.8) && (g < 1.2) && (b > 1.2)) {
 Serial.print("\tBLAU");
 myservo.write(bluePos);
 }

  else if ((r > 1.15) && (g > 1.15) && (b < 0.7)) {
  Serial.print("\tGELB");
  myservo.write(yellowPos);
   }
  else if ((r > 1.4) && (g < 1.0) && (b < 0.7)) {
  Serial.print("\tORANGE");
  myservo.write(orangePos);
  } 
  else {
  Serial.print("\tNICHT ERKANNT"); 
  myservo.write(nonePos);
   }


 Serial.println("");

delay(100);
Source Link

color sensor code arduino

All this code does is detect a color then rotates to the corresponding color on the color wheel using a servo. I want to change the colors which i am guessing would not be too hard. My question for now is, how does this code tell the servo to rotate to the correct position after it has detected a certain color. I believe all i have to do is add one more else if statement then change the color range to what i want, But i am not sure i would account for that with the positions for the servo.

// Libraries einbinden
   #include "Servo.h"
   #include "Wire.h"
   #include "Adafruit_TCS34725.h"

// Servo-Positionen in Grad für Farben, bitte anpassen
 const int redPos = 160;
 const int orangePos = 130;
 const int yellowPos = 100;
 const int greenPos = 70;
 const int bluePos = 30;
 const int nonePos = 0; // Kein Objekt erkannt

 // Servo-Objekt initialisieren
  Servo myservo;

// Color Sensor-Objekt initialisieren
// Parameter siehe: https://learn.adafruit.com/adafruit-color-sensors/program-it
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X);

 // setup() wird einmal beim Start des Arduino ausgeführt
void setup() {

// Serielle Kommunikation zur Ausgabe der Wert im seriellen Monitor
Serial.begin(9600);
Serial.println("Makerblog.at - MuMs Color Sensor");

 // Überprüfen, ob Color Sensor sich auch zurückmeldet
 if (tcs.begin()) {
 // Alles OK
 Serial.println("Sensor gefunden");
 } else {
 // Kein Sensor gefunden. Programm an dieser Stelle einfrieren
 Serial.println("TCS34725 nicht gefunden ... Ablauf gestoppt!");
 while (1); // Halt!
         } 

 // Der Servo hängt am PWM-Pin 3 
 myservo.attach(3);
// Servo in Grundstellung fahren
myservo.write(0);
delay(1000);

 }

 // loop() wird wiederholt, solange der Arduino läuft
 void loop() {

 // Der Sensor liefert Werte für R, G, B und einen Clear-Wert zurück
uint16_t clearcol, red, green, blue;
 float average, r, g, b;
 delay(100); // Farbmessung dauert c. 50ms 
tcs.getRawData(&red, &green, &blue, &clearcol);

// Mein Versuch einer Farbbestimmung für 
// die 5 M&M-Farben Rot, Grün, Blau, Orange und Gelb

// Durchschnitt von RGB ermitteln
average = (red+green+blue)/3;
// Farbwerte durch Durchschnitt, 
// alle Werte bewegen sich jetzt rund um 1 
r = red/average;
g = green/average;
b = blue/average;

// Clear-Wert und r,g,b seriell ausgeben zur Kontrolle
// r,g und b sollten sich ca. zwischen 0,5 und 1,5 
// bewegen. Sieht der Sensor rot, dann sollte r deutlich über 1.0
// liegen, g und b zwischen 0.5 und 1.0 usw.
Serial.print("\tClear:"); Serial.print(clearcol);
Serial.print("\tRed:"); Serial.print(r);
Serial.print("\tGreen:"); Serial.print(g);
Serial.print("\tBlue:"); Serial.print(b);

 // Versuch der Farbfeststellung anhand der r,g,b-Werte.
 // Am besten mit Rot, Grün, Blau anfangen die die Schwellenwerte
 // mit der seriellen Ausgabe entsprechend anpassen
 if ((r > 1.4) && (g < 0.9) && (b < 0.9)) {
  Serial.print("\tROT");
  myservo.write(redPos);
  }
 else if ((r < 0.95) && (g > 1.4) && (b < 0.9)) {
 Serial.print("\tGRUEN");
 myservo.write(greenPos);
}
 else if ((r < 0.8) && (g < 1.2) && (b > 1.2)) {
 Serial.print("\tBLAU");
 myservo.write(bluePos);
 }
 // Gelb und Orange sind etwas tricky, aber nach etwas
 // Herumprobieren haben sich bei mir diese Werte als
 // gut erwiesen
  else if ((r > 1.15) && (g > 1.15) && (b < 0.7)) {
  Serial.print("\tGELB");
  myservo.write(yellowPos);
   }
  else if ((r > 1.4) && (g < 1.0) && (b < 0.7)) {
  Serial.print("\tORANGE");
  myservo.write(orangePos);
  } 
  // Wenn keine Regel greift, dann ehrlich sein
  else {
  Serial.print("\tNICHT ERKANNT"); 
  // myservo.write(nonePos);
   }


 // Zeilenwechsel ausgeben
 Serial.println("");

// Wartezeit anpassen für serielles Debugging
delay(100);