Welcome Customer !

Membership

Yangjiang RUIXIAO Enterprise Co, . Ltd
Free Member ·1YRS
,
Other

Main Products: 电子器件

Xwboo>Products
Product Categories

Yangjiang RUIXIAO Enterprise Co, . LtdFree·1YRS

  • E-mail

    averychen613@gmail.com

  • Phone

  • Address

    1/F, Building 4, *** Street , Nanpai , Jiangcheng District, Yangjiang City , Guangdong Province, china

Contact Now

KY-027

Model
Nature of the Manufacturer
Other
Product Category
Place of Origin
City, Province
Overview
KY-027
Product Details

The magic light cup contains two identical modules, a single module is composed of an LED light and a mercury switch.
The principle of dimming is to use two modules to change the principle of brightness as pwm. The Mercury switch provides a digital signal to trigger the PWM through programming, and we can see that the light of the two cups is full of the effect of dragging back and forth.
Test code:
int LedPinA = 5;
int LedPinB = 6;
int ButtonPinA = 7;
int ButtonPinB = 4;
int buttonStateA = 0;
int buttonStateB = 0;
int brightness = 0;
void setup()
pinMode (LedPinA, OUTPUT);
pinMode (LedPinB, OUTPUT);
pinMode (ButtonPinA, INPUT);
pinMode (ButtonPinB, INPUT);
void loop()
buttonStateA = digitalRead(ButtonPinA);
if (buttonStateA == HIGH && brightness!= 255)
Brightness++;
buttonStateB = digitalRead(ButtonPinB);
if (buttonStateB == HIGH && brightness!= 0)
Brightness-;
analogWrite(LedPinA, brightness); //
analogWrite(LedPinB, 255-brightness); //

Similar Product Recommend