[Arduino | Windows] LED 센서 모듈 테스트

LED 센서 모듈, ESP32 확장 보드, 브레드보드(빵판)을 사용하여 테스트를 진행했다.

 

LED 센서 모듈 ESP32 확장 보드
G D16
R D4
B D2
I GRD

 

#define RED_PIN 4
#define GREEN_PIN 16
#define BLUE_PIN 2

void setup() {
  pinMode(RED_PIN, OUTPUT);
  pinMode(GREEN_PIN, OUTPUT);
  pinMode(BLUE_PIN, OUTPUT);

  digitalWrite(RED_PIN, HIGH);
  digitalWrite(GREEN_PIN, HIGH);
  digitalWrite(BLUE_PIN, HIGH);
}

void loop() {
  // 빨강
  analogWrite(RED_PIN, 0);
  analogWrite(GREEN_PIN, 255);
  analogWrite(BLUE_PIN, 255);
  delay(1000);
  
  // 초록
  analogWrite(RED_PIN, 255);
  analogWrite(GREEN_PIN, 0);
  analogWrite(BLUE_PIN, 255);
  delay(1000);

  // 파랑
  analogWrite(RED_PIN, 255);
  analogWrite(GREEN_PIN, 255);
  analogWrite(BLUE_PIN, 0);
  delay(1000);

  analogWrite(RED_PIN, 255);
  analogWrite(GREEN_PIN, 255);
  analogWrite(BLUE_PIN, 255);
  delay(1000);
}

 

(옆에 껀 온습도 센서인데 해당 포스팅에선 사용 안하므로 무시하면 된다)


참고 레퍼런스

ESP32로 만드는 IoT 월드 with 아두이노 IDE 2