int merah = 21;
int hijau = 22;
int biru = 23;
int angka = 4;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(merah, OUTPUT);
pinMode(hijau, OUTPUT);
pinMode(biru, OUTPUT);
/*digitalWrite(merah, HIGH);
digitalWrite(biru, HIGH);
digitalWrite(hijau, HIGH);*/
while(angka>=0){
RGB(1,0,0);
delay(500);
RGB(0,1,0);
delay(500);
RGB(0,0,1);
delay(500);
RGB(1,1,0);
delay(500);
RGB(1,0,1);
delay(500);
RGB(0,1,1);
delay(500);
RGB(1,1,1);
delay(500);
Serial.println(angka);
angka--;
}
RGB(0,0,0);
delay(500);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}
void RGB(bool pinmerah, bool pinhijau, bool pinbiru){
digitalWrite(merah, pinmerah);
digitalWrite(biru, pinbiru);
digitalWrite(hijau, pinhijau);
}