본문 바로가기

Arduino

LED_blink_fading_delay

int ledPin = 11;

void setup() {  
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);           
  digitalWrite(13, LOW); 
  delay(1000);  

  for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
	analogWrite(ledPin, fadeValue);
	delay(30);
  }
  for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {
	analogWrite(ledPin, fadeValue);
	delay(30);
  }  
}

'Arduino' 카테고리의 다른 글

BT input  (0) 2022.03.15
LED control with SerialRead  (0) 2022.03.14
RGB_fading  (0) 2022.03.11
RGB_Blink  (0) 2022.03.11
LED_Blink_Fading_millis  (0) 2022.03.10