VMA325
V. 01 – 19/03/2018
6
©Velleman nv
}
void setup()
{
TSC_Init();
lcd.init();
delay(100);
lcd.backlight();
Wire.begin();
delay(100);
lcd.setCursor(14,0);
lcd.print("Color");
lcd.setCursor(0,3);
lcd.print("S0:2 S1:3 S2:4 S3:5 OUT:6 LED:-");
Serial.begin(9600);
Timer1.initialize(); // defaulte is 1s
Timer1.attachInterrupt(TSC_Callback);
attachInterrupt(0, TSC_Count, RISING);
delay(4000);
for(int i=0; i<3; i++)
Serial.println(g_array[i]);
g_SF[0] = 255.0/ g_array[0]; //R Scale factor
g_SF[1] = 255.0/ g_array[1] ; //G Scale factor
g_SF[2] = 255.0/ g_array[2] ; //B Scale factor
Serial.println(g_SF[0]);
Serial.println(g_SF[1]);
Serial.println(g_SF[2]);
//for(int i=0; i<3; i++)
// Serial.println(int(g_array[i] * g_SF[i]));
}
void loop()
{
g_flag = 0;
for(int i=0; i<3; i++)
{
Serial.println(int(g_array[i] * g_SF[i]));
//lcd.setCursor(0,1);
//lcd.print(int(g_array[i] * g_SF[i]));
}
lcd.setCursor(0,1);
lcd.print(int(g_array[0] * g_SF[0]));
lcd.setCursor(6,1);
lcd.print(int(g_array[1] * g_SF[1]));
lcd.setCursor(12,1);
lcd.print(int(g_array[2] * g_SF[2]));
delay(4000);
Clean2004();
}
void Clean2004()
{