Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

RGB Arduino uno r3

char p;

#include <IRremote.h>


IRrecv Yenuka(A2);
decode_results results;

#define redPin 6

#define greenPin 3

#define bluePin 5
void setup() {


   digitalWrite(6,HIGH);
   
    digitalWrite(3,HIGH);
   
    digitalWrite(5,HIGH);


  Serial.begin(9600);
  Yenuka.enableIRIn();

 
  pinMode(redPin, OUTPUT);

  pinMode(greenPin, OUTPUT);

  pinMode(bluePin, OUTPUT);

}

void loop() {

if (Yenuka.decode(&results)) {
    Serial.println(results.value, DEC);
    Yenuka.resume();
  }
  delay(100);

  long val = results.value;

    if (Yenuka.decode(&results)) {
    Serial.println(results.value, DEC);
    Yenuka.resume();
  }
 
if (val ==62855) {
    digitalWrite(6,LOW);//red color
     
    
  }
  if (val == 62791) {
 digitalWrite(3,LOW);//green color
   
  }
    if (val == 62919) {
 digitalWrite(5,LOW);//blue color
   
  }
    if (val == 62759) {//cyan
 digitalWrite(3,LOW);
   
    digitalWrite(5,LOW);
   
  }
      if (val == 62887) {//megenta
 digitalWrite(6,LOW);
   
    digitalWrite(5,LOW);
   
  }
       if (val == 62823) {//Yellow
 digitalWrite(6,LOW);
   
    digitalWrite(3,LOW);
   
  }
       if (val == 62951) {//White
 digitalWrite(6,LOW);
   
    digitalWrite(3,LOW);
 
    digitalWrite(5,LOW);
 
  }
  if (val == 50664) {//off
 digitalWrite(6,HIGH);
   
    digitalWrite(3,HIGH);
   
    digitalWrite(5,HIGH);
 
  }

if(Serial.available()){
  p = Serial.read();
  Serial.println(p);
}
 
if(p =='n'){            
 digitalWrite(6,HIGH);
   
    digitalWrite(3,HIGH);
   
    digitalWrite(5,HIGH);
 



}
 
else if(p == 'w'){    
 

 digitalWrite(6,LOW);
   
    digitalWrite(3,LOW);
 
    digitalWrite(5,LOW);


}
else if(p == 'r'){    
 

 digitalWrite(6,LOW);//red color


}
else if(p == 'g'){    
 

digitalWrite(3,LOW);//green color


}
 else if(p == 'b'){    
 

 digitalWrite(5,LOW);//blue color


}
 else if(p == 'c'){    
 

 digitalWrite(3,LOW);
   
    digitalWrite(5,LOW);


}
 else if(p == 'm'){    
 
 digitalWrite(6,LOW);
   
    digitalWrite(5,LOW);



}
 else if(p == 'y'){    
 
 digitalWrite(6,LOW);
   
    digitalWrite(3,LOW);



}

delay(100);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: temp^late php table for mysql 
Csharp :: how to take previous record in linq c# 
Csharp :: c# ipaddress to integer 
Csharp :: recursively fing root of tree 
Csharp :: gersener waves 
Csharp :: EntityFramework: using tables in different scemas 
Csharp :: make tooltip disappear c# 
Csharp :: web socket background.js example 
Csharp :: bubble sort recursive c# 
Csharp :: open aspx page c# 
Csharp :: resize image and add watermark c# 
Csharp :: afaik 
Csharp :: PUN 2 Network Transform View Jittery Movement 
Csharp :: c# download to string 
Csharp :: how to change samesite=lax to samesite=none in asp.net 
Csharp :: c# if a new program is started 
Csharp :: .net return context.Result without extra new objectResult 
Csharp :: Unity PlayOneShoot Audio 
Csharp :: c# sort word 
Csharp :: wpf create rectangle c# 
Csharp :: internal static object ds 
Csharp :: list in c# foreach 
Csharp :: add getenumerator to class c# 
Csharp :: c# dictionary contain key but returns false 
Csharp :: C# free text search 
Csharp :: c# url relative path remove 
Csharp :: how to play a random sound at the position that you want in unity 
Csharp :: C# count specific words in string 
Csharp :: prime number generator 
Csharp :: extension of c sharp 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =