Difference between revisions of "Fire Evacuation Drill"

From Microduino Wiki
Jump to: navigation, search
Line 101: Line 101:
  
 
==FAQ==
 
==FAQ==
*Dose the analog output pin of Hub have only 的模拟输出管脚只有6/7,10/11口吗?
+
*Are the analog output pins of Hub only 6/7, and 10/11?
**If you adopt Core as the core, you can only choose 6, 7, and the devices outputting analog signal (0-255)must be connected to one of the pins of Hub 6/7, 10/11. Because the analog signal is actually simulated out by the background program with digital signal, you can only use even pins, they are 6 and 10 in Mixly.  
+
**If you adopt Core as the core, you can only choose 6, 10, and the devices outputting analog signal (0-255)must be connected to one of the pins of Hub 6/7, 10/11. Because the analog signal is actually simulated out by the background program with digital signal, you can only use even pins, they are 6 and 10 in Mixly.  
 
<br>
 
<br>
 
'''PWM supporting port of Core'''
 
'''PWM supporting port of Core'''
 
* '''Core'''  PWM supporting, totally 6:  
 
* '''Core'''  PWM supporting, totally 6:  
** On the module labeled D3,D5,D6,D9,D10,D11
+
** On the module labeled D3, D5, D6, D9, D10, D11
 
** For details, please refer to: '''[http://www.arduino.cc/en/Reference/AnalogWrite analogWrite()]'''
 
** For details, please refer to: '''[http://www.arduino.cc/en/Reference/AnalogWrite analogWrite()]'''
 
* Core+ PWM supporting, totally 8:  
 
* Core+ PWM supporting, totally 8:  
** On the module labeled D7,D8,D9,D10,D12,D13,D22,D23
+
** On the module labeled D7, D8, D9, D10, D12, D13, D22, D23
 
** For details, please refer to: '''[http://www.arduino.cc/en/Reference/AnalogWrite analogWrite()]'''
 
** For details, please refer to: '''[http://www.arduino.cc/en/Reference/AnalogWrite analogWrite()]'''
  
 
|}
 
|}

Revision as of 04:55, 28 September 2016


Outline

Anywhere light blink.jpg

Let us make a fire indicating light, which will flash unceasingly to warn people to leave at once when a fire appear.

Suitable kits: mCookie102, mCookie202, mCookie302, IBC


Module Bill

Module

Module Number Function
mCookie-Core 1 Core board
mCookie-USBTTL 1 Program download module
mCookie-Hub 1 Sensor adapter plate
LED 1 Single-color LED

Other Equipment

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


Module Setup

Anywhere lightblink-module—step.jpg
  • Assemble modules and sensors:
    • Stick the red core module, USB upload module and green extension module together;
    • Connect the red LED to pin 6/7 of the extension module;
    • Insert one end of the USB cable into USB upload module, and connect the other to the computer;


Programming

Look at the New Program Block

"Analog Write" Program Block
"Analog write" program block is in the "Microduino>Core" tab.

Mixly-analogoutput-where.jpg

"Analog write" program block instruction
"Analog write" program block can divide the energy into 256 levels: the lowest is 0, which control the LED to off; the highest is 255, which controls the LED to on, and is the brightest. Other numbers in 0~255 can make the light light different brightness.

Mixly-analogoutput-explain.jpg

Digital output pin of Hub
"Analog output" pin is the interface of the connection between sensors and extension module,and the extension module has 2 analog signal pins: 6/7, 10/11.


Difference between "digital output" and "analog output" program blocks

  • Digital output
    • Just like the switch of the light, it has on and off two states, when the state is off, the light doesn't light, when it is on, the light is the most bright.
  • Analog output
    • Just like the the light dimmer knob of the light, it can make the light change between dark and the most bright, and in the program, it transits between 0~255 levels, 0 representing dark, 255 the most bright.

”Delay” program block
"Delay" program block is in the "control" tab.

Introduction of "Delay" program block "Delay" program block can make the program stay at the same place for a certain time, and then execute the next program. While the program block is being executed, you can’t do any other things until the end of this time.

Programming Thought

If you want to implement the effect of flashing of the LED, you need "analog output" program block to control the brightness of it, and "delay" program block to control the time interval. Through different brightness and time intervals, simulate the light flashing.

Mixly-ctrl-ledblink.jpg

Programming

1.LED is on for 1s in weaker brightness.
Change the pin of "analog output" into 6, and assign 120 to it; set the delay to 1000ms, namely 1s.

Mixly-ctrl-ledblink-code1.jpg

2.LED is on in relatively bright light for 1s
Change the pin of “analog output” into 6, and assign 240 to it;set the delay time to 1000ms, namely 1s.

Mixly-ctrl-ledblink-code2.jpg

3.Link the two program blocks together, and choose the core and port to download the program.

Test the result:
After upload, if you see the LED flash dark and bright, that is saying our fire alarming light is done!
Set up an emergency exit with Lego, and install our light on it, then introduce the escape safely knowledge to your friends.

Anywhere light blink.jpg

Can It Be Played in Another Way

Q: Can you set the fire alarming light of three kinds of brightness, and make it flash quicker at the same time? So that it will be easier to attract the intention of people.
A: It is very easy. Just set 3 brightness between 0-255 and make every brightness last shorter time.

Mixly-ctrl-ledblink-code3.jpg

FAQ

  • Are the analog output pins of Hub only 6/7, and 10/11?
    • If you adopt Core as the core, you can only choose 6, 10, and the devices outputting analog signal (0-255)must be connected to one of the pins of Hub 6/7, 10/11. Because the analog signal is actually simulated out by the background program with digital signal, you can only use even pins, they are 6 and 10 in Mixly.


PWM supporting port of Core

  • Core PWM supporting, totally 6:
    • On the module labeled D3, D5, D6, D9, D10, D11
    • For details, please refer to: analogWrite()
  • Core+ PWM supporting, totally 8:
    • On the module labeled D7, D8, D9, D10, D12, D13, D22, D23
    • For details, please refer to: analogWrite()