Magic Light Cup Module (KY-027)
  • Magic Light Cup Module (KY-027)

#220: Magic Light Cup Module (KY-027)

R42.10


Mercury switches provide a digital signal that triggers the PWM , through the program design, we can then see the light like two cups filled with the effect of shuffling back and forth.

 

dimming principle is to use the principle of two modules brightness changes for pwm.

   Mercury switches provide a digital signal that triggers the PWM , through the program design,

   We can see the light like two cups filled with the effect of shuffling 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); //

   delay(25);

   }

Product Details

[None Specified]

Tutorials

Arduino Automated Plant Water Project
A simple but practical Arduino project to automatically water your plants, showing the usage of a 7-Segment Display, a Soild Moisture Sensor, a Temperature Sensor and a Relay.

Arduino Introduction
Introducing you to the awesome Arduino!

BUY

Magic Light Cup Module (KY-027)

Regular price: R42.10
Qty To Purchase:
In Stock: 24



Categories
 

Couldn't find the electronic components that you need? - Have a look at these sponsored advertisements for related products or get in contact to let us source your required components.