Paso 3: Pieza de Software:
Sesli Renk Okuyan Robot Projesi Robimek 2015
Lisans Yazılım por Robimek
#include "Wire.h"
#include "Adafruit_TCS34725.h"
#include < Wtv020sd16p.h >
WTV020 pinleri
int resetPin = 13;
clockPin int = 11;
int dataPin = 12;
int busyPin = 10;
WTV020 pin Msvbvm50.dll
Wtv020sd16p(resetPin,clockPin,dataPin,busyPin) de Wtv020sd16p;
Adafruit_TCS34725 tcs = Adafruit_TCS34725 (TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X);
void setup() {Serial.begin(9600);
wtv020sd16p.Reset();
wtv020sd16p.playVoice(2);
wtv020sd16p.playVoice(5);
Delay(5000);
Si (tcs.begin()) {+-Serial.println ("Sensör bulundu");}
Else {Serial.println ("Sensör TCS34725 bulunamadı!");
mientras (1); Dur! } delay(1000); }
void loop() {uint16_t clearcol, rojo, verde, azul; float promedio, r, g, b;
tcs.getRawData (y rojo y verde y azul y clearcol);
promedio = (rojo + verde + azul) / 3; r = rojo/promedio; g = verde/promedio;
b = azul/promedio; Serial.Print("\tTEMİZ:"); Serial.Print(clearcol);
Serial.Print("\tKIRMIZI:"); Serial.Print(r); Serial.Print("\tYEŞİL:");
Serial.Print(g); Serial.Print("\tMAVİ:"); Serial.Print(b);
Si ((r > 1.4) & & (g < 0.9) & & (b < 0.9))
{/ / kırmızı algılama Serial.print("\tKIRMIZI");
wtv020sd16p.playVoice(2); Kırmızı söyle delay(2000); }
else if ((r < 0.95) & & (g > 1.4) & & (b < 0.9)) {/ / Yesil algılama Serial.print("\tYEŞİL");
Yesil söyle wtv020sd16p.playVoice(7); Delay(2000); } else if ((r < 0.8) & & (g < 1.2) & & (b > 1.2))
{/ / mavi algılama Serial.print("\tMAVİ"); / / mavi söyle wtv020sd16p.playVoice(3);
Delay(2000); } else if ((r > 1.15) & & (g > 1.15) & & (b < 0.7)) {/ / algılama sarı Serial.print("\tSARI");
Sarı söyle wtv020sd16p.playVoice(6); Delay(2000); }
else if ((r > 1.4) & & (g < 1.0) & & (b < 0.7)) {/ / turuncu algılama Serial.print("\tTURUNCU");
Turuncu söyle wtv020sd16p.playVoice(5); Delay(2000); }
Else {Serial.print ("\tRENK ALGILANMADI");} Serial.println(""); Delay(2000); }
Más İnformation: Color habla Robot