Constellation Projection Lamp

From Microduino Wiki
Jump to: navigation, search

Outline

Anywhere constellation.jpg

Let's make a constellation projection lamp whose color can be switched with two touch buttons, and implement the effect of breathing lamp through keeping pressing the touch button all the time.
Suitable kits: mCookie302, IBC


Module Bill

Module

Module Number Function
mCookie-Core 1 Core board
Battery box 1 Program download and power supply
mCookie-Hub 1 Sensor adapter plate
Touch button 2 Detect the touch
ColorLED 1 Color LED

Other Equipment

  • USB cable*1
  • Sensor cable*3
  • Sensor shell*1
  • Lego or other fixation structure
Anywhere constellation-module.jpg

Module Setup

Setup

Anywhere constellation-step.jpg
  • Assemble the modules and sensors:
    • Stick the red core module, battery base and green extension module together;
    • Connect the color LED cable to pin 6/7 of Hub;
    • Connect the 2 crash button to pin 4/5 and 2/3 of Hub respectively;
    • Insert one end of USB cable into the battery base, and connect the other to computer;

Programming

Required Program Blocks

Programming Thought

Press the touch button 2, and you will see the effect of green breathing lamp; press the touch sensor 2, and you will see the effect of blue breathing lamp.

Mixly-ctrl-constellation.jpg

Start to Program

ColorLED prepare, control the green breathing effect through touching the touch button 4.
If touch sensor 4 is pressed, "every time" will be used to make the green LED change from weaker to the brightest gradually, implementing the effect of breathing lamp. If the touch sensor keeps being pressed down, the green light repeat breathing in cycle.

Mixly-ctrl-constellation-code.jpg

Effect of blue breathing lamp
If touch button 2 is pressed, "every time" will be used to make the blue LED change from the brightest to weaker, implementing the effect of breathing lamp. If the touch button keeps being pressed down, the blue light will repeat breathing in cycle.

Mixly-ctrl-constellation-code1.jpg



Test the result
Keep holding touch button 4, and you will see the effect of green breathing lamp. Keep holding touch button 2, and you will see the effect of blue breathing lamp.
Set up a constellation projection lamp with lego. Draw your own constellation diagram and stellar map on the paper, with circles representing the stars; Poke the stars with scissor or nib, letting the light in.

Anywhere constellation.jpg

Technical Specification

  • The produce number of color LED: MSDL11
  • API library is required to drive.
  • For details about color LED, please refer to Sensor-Color LED
  • For details about touch button, please refer to Sensor-Touch Button

Related Cases

Q&A

  • Q: Why does it breath in cycle only when the touch button keeps being pressed down?
    • A: Because after press, the state of release has only one, and the "every time" will be executed once, if keep pressing, it can breath in cycle.