int r,g,b,valr,valg,valb;
void setup() {
// put your setup code here, to run once:
pinMode(7, INPUT);
pinMode(13,OUTPUT);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(7)==HIGH){
digitalWrite(13, HIGH);
}
else{
digitalWrite(13,LOW);
}
r = analogRead(A0);
g = analogRead(A1);
b = analogRead(A2);
Serial.println(digitalRead(7));
Serial.println();
valr = map(r,0,1023,0,255);
valg = map(g,0,1023,0,255);
valb = map(b,0,1023,0,255);
Serial.println(valr);
analogWrite(11,valr);
analogWrite(10,valg);
analogWrite(9,valb);
}