Ks0030 keyestudio Magical Light Cup Module: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
Line 2: Line 2:
Magic light cup module developed by KEYES is able to interact with ARDUINO. It is based on the principle of PWM dimming; The brightness of two modules change. The mercury switch provides a digital signal and trigger PWM regulation, and you can see the effect like changing two sets of cup fulled of light through the program design.
Magic light cup module developed by KEYES is able to interact with ARDUINO. It is based on the principle of PWM dimming; The brightness of two modules change. The mercury switch provides a digital signal and trigger PWM regulation, and you can see the effect like changing two sets of cup fulled of light through the program design.


<br>[[File:301.png|500px|frameless|thumb]]<br>
<br>[[File:Ks0030-1.png|500px|frameless|thumb]]<br>


==Specification==
==Specification==

Revision as of 09:28, 20 March 2018

Introduction

Magic light cup module developed by KEYES is able to interact with ARDUINO. It is based on the principle of PWM dimming; The brightness of two modules change. The mercury switch provides a digital signal and trigger PWM regulation, and you can see the effect like changing two sets of cup fulled of light through the program design.


thumb

Specification

  • Supply Voltage: 3.3V to 5V
  • Interface: Digital

Connection Diagram


thumb

Sample Code

int LedPinA = 5;
int LedPinB = 6;
int ButtonPinA = 7;
int ButtonPinB = 4;
int buttonStateA = 0;
int buttonStateB = 0;
int brightnessA = 0;
int brightnessB= 255;
void setup()
{
Serial.begin(9600);
pinMode(LedPinA, OUTPUT);
pinMode(LedPinB, OUTPUT);


pinMode(ButtonPinA, INPUT);
pinMode(ButtonPinB, INPUT);
}
void loop()
{
buttonStateA = digitalRead(ButtonPinA);
if (buttonStateA == HIGH && brightnessA != 255)
{
brightnessA ++;
}
if (buttonStateA == LOW && brightnessA != 0)
{
brightnessA --;
}
analogWrite(LedPinB, brightnessA);
Serial.print(brightnessA);

Serial.print("   ");
buttonStateB = digitalRead(ButtonPinB);
if (buttonStateB == HIGH && brightnessB != 0)
{
brightnessB --;
}
if (buttonStateB == LOW && brightnessB != 255)
{
brightnessB++;
}
analogWrite(LedPinA, brightnessB); 
Serial.println(brightnessB);
delay(5);
}

Resources

Video

http://www.keyestudio.com/wp/2016/05/ks0030-keyestudio-magical-light-cup-module/

PDF

http://www.keyestudio.com/files/index/download/id/1463650092/

Buy from

Official Website

http://www.keyestudio.com/keyestudio-magical-light-cup-module-for-arduino.html

Amazon Store

https://www.amazon.com/Keyestudio-Magical-Module-Arduino-raspberry/dp/B0172S3LGM/ref=sr_1_1?ie=UTF8&qid=1479874070&sr=8-1&keywords=keyestudio+Magical+light+cup+module+for+Arduino