Arduno diy 스타터 키트 ky027에 대 한 KY-027 매직 라이트 컵 센서 모듈
디밍 원리는 pwm 용 두 개의 모듈 밝기 변화의 원리를 사용하는 것입니다.
수은 스위치는 프로그램 설계를 통해 pwm을 트리거하는 디지털 신호를 제공합니다.
우리는 앞뒤로 셔플링의 효과로 가득 찬 두 컵처럼 빛을 볼 수 있습니다.
테스트 코드:
Int LedPinA = 5;
Int LedPinB = 6;
Int ButtonPinA = 7;
Int ButtonPinB = 4;
Int buttonStateA = 0;
Int buttonStateB = 0;
Int 밝기 = 0;
Void 설정 ()
PinMode (LedPinA, 산출);
PinMode (LedPinB, 산출);
PinMode (ButtonPinA, 입력);
PinMode (ButtonPinB, 입력);
Void 루프 ()
ButtonStateA = digitalRead(ButtonPinA);
경우 (buttonStateA = = 높은 & 밝기! = 255)
밝기 ++;
ButtonStateB = digitalRead(ButtonPinB);
경우 (buttonStateB = = 높은 & 밝기! = 0)
Brighness-;
AnalogWrite (LedPinA, 밝기); /
AnalogWrite (LedPinB, 255-밝기); /
지연 (25);
패키지 포함:
1 X KY-027 매직 라이트 컵 모듈신청 : 컴퓨터
모델 번호 : Module
분산 전원 : W
유형 : 전압 조정기
공급 전압 : V
근원 : CN (정품)
패키지 : SMD
맞춤 가능 유무 : 그렇습니다
조건 : 새로운
작용 온도 : -20 to +50