아두이노 빛의 세기에 따라 소리,LED밝기 조절 예제
●빛의 세기에 따라 소리,LED밝기 조절 예제 const int ledPin = 6;const int buzzerPin = 3;const int lightPin = A0;int lightValue;int brightness; void setup() {} void loop() { lightValue = analogRead(lightPin); brightness = map(lightValue, 0,1023,0,255); analogWrite(ledPin,brightness); brightness = map(lightValue, 0,1023,100,1000); tone(buzzerPin,lightValue);}
2016. 1. 1.