Page 130 - EMODUL TEKNIK KENDALI DIGITAL FT
P. 130
Universitas Negeri Makassar 117
String IRButton3 = "FD48B7";
String IRButton4 = "FD28D7";
const int ledPin1 = 2;
const int ledPin2 = 3;
const int ledPin3 = 4;
const int ledPin4 = 5;
IRrecv irrecv(RECV_PIN);
decode_results results;
String BUTTONPRESSED;
int button1 = 0;
int button2 = 0;
int button3 = 0;
int button4 = 0;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
BUTTONPRESSED = String(results.value, HEX);
BUTTONPRESSED.toUpperCase();
Serial.print("BUTTONPRESSED ");
Serial.println(BUTTONPRESSED);
//delay(1000);
//button 1
if (BUTTONPRESSED == IRButton1){
if (button1 == 0){
TEKNIK KENDALI DIGITAL | UNM