Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int Red = 3;
- const int Green = 4;
- const int Blue = 5;
- void setup() {
- pinMode(Red,OUTPUT);
- pinMode(Green,OUTPUT);
- pinMode(Blue,OUTPUT);
- pinMode(A1,INPUT);
- Serial.begin(9600);
- }
- void loop() {
- int light;
- light = analogRead(A1)/100;
- if(light>8){
- colora(200,150,150);
- }else{
- colora(255,0,0);
- }
- Serial.println(light);
- delay(100);
- }
- void colora(int R, int G, int B){
- analogWrite(Red, R);
- analogWrite(Green, G);
- analogWrite(Blue, B);
- }
Advertisement
Add Comment
Please, Sign In to add comment