Ks0030 keyestudio Magical Light Cup Module: Difference between revisions
Jump to navigation
Jump to search
Keyestudio (talk | contribs) (Created page with "==Introduction== Magic light cup module developed by Shenzhen KEYES Robot Co. Ltd is a module able to be interactive with ARDUINO. The principle is based on the principle o...") |
Keyestudio (talk | contribs) No edit summary |
||
Line 66: | Line 66: | ||
}</pre> | }</pre> | ||
==Video== | |||
http://www.keyestudio.com/wp/2016/05/ks0030-keyestudio-magical-light-cup-module/ | |||
[[Category: Sensor]] | [[Category: Sensor]] |
Revision as of 14:50, 29 September 2016
Introduction
Magic light cup module developed by Shenzhen KEYES Robot Co. Ltd is a module able to be interactive with ARDUINO.
The principle 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 then we
can see the effect like changing two set of cups full of light through the program design.
Specification
- Supply Voltage: 3.3V to 5V
- Interface: Digital
Connection Diagram
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); }
Video
http://www.keyestudio.com/wp/2016/05/ks0030-keyestudio-magical-light-cup-module/