Welcome to KZY Electronic Technology Co., Ltd
You are here:Home >> Products >> Sensor Module

Products

Products

Contact us

Contact: Louis
WhatsappWeChat : +86 18617158103
Tel: +86 18617158103
Direct: +86-0755-22235249
Made in china store: https://fut688.en.made-in-china.com/
Alibaba store: https://fut688.en.made-in-china.com/
Website: www.kzyeducabot.com
Add: Room 301, 3rd Floor, Zhengtong Pioneer Park, No. 12, Liuyuepuxia Road, Henggang Street Office, Longgang District, Shenzhen, Guangdong Province, China

Sensor Module

KY-027 Magic Light Cup Sensor Module for R3C25 Electronic Building Blocks Diy Starter Kit KY027 5V Electronics Board

KY-027 Magic Light Cup Sensor Module for R3C25 Electronic Building Blocks Diy Starter Kit KY027 5V Electronics Board

Magic Light Cup Module Starters Compatible 

Magic Light Cup Module starters Compatible KY-027

4pin KY-027 Magic Light Cup Sensor Module diy Starter Kit

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)
   brighness --;
   analogWrite(LedPinA, brightness); //
   analogWrite(LedPinB, 255 - brightness); //
  • KY-027 Magic Light Cup Sensor Module for R3C25 Electronic Building Blocks Diy Starter Kit KY027 5V Electronics Board

    Magic Light Cup Module Starters Compatible 

    Magic Light Cup Module starters Compatible KY-027

    4pin KY-027 Magic Light Cup Sensor Module diy Starter Kit

    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)
       brighness --;
       analogWrite(LedPinA, brightness); //
       analogWrite(LedPinB, 255 - brightness); //
       delay(25);
  • Please submit your basic information, we will contact you as soon as possible!

    *

    *

    *

    *

Related products

Copyright 2022 KZY Electronic Technology Co., Ltd  All Rights Reserved  
Web Design—Tiandixin