Difference between revisions of "Fire Evacuation Drill"

From Microduino Wiki
Jump to: navigation, search
(Created page with "{| style="width: 1000px;" |- | ==Outline== 600px|center Let us make a fire indicating light, which will flash unceasingly to warn people t...")
 
(Required Program Block)
 
(3 intermediate revisions by the same user not shown)
Line 44: Line 44:
  
 
==Programming==
 
==Programming==
===Look at the New Program Block===
+
===Required Program Block===
'''"Analog Write" Program Block'''
+
*[["Analog write" program block]]
<br>
+
*[["Delay" program block]]
"Analog write" program block is in the "Microduino>Core" tab.
+
 
[[File:mixly-analogoutput-where.jpg|600px|center]]
+
===Programming Thought===
'''"Analog write" program block instruction'''
+
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.  
<br>
 
"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. 0~255中的其它数值会让灯呈现不同亮度。
 
[[File:mixly-analogoutput-explain.jpg|600px|center]]
 
'''Hub的数字输出管脚'''
 
<br>
 
"模拟输出"管脚号是传感器与扩展模块连接的接口号,扩展模块有2个模拟信号接口:6/7,10/11。
 
<br>
 
[[File:hub-analogoutput-explain.jpg|600px|center]]
 
<br>
 
'''"数字输出"和“模拟输出”程序块的区别'''
 
*'''数字输出'''
 
**就好像电灯的开关,只有开和关两种状态,关的时候灯不亮,开的时候灯最亮。
 
*模拟输出
 
**就好像电灯的调光旋钮,可以使灯的亮度在完全不亮和最亮之间自由变化,在程序中是从0~255级过渡,0为不亮,255为最亮。
 
[[File:hub-analogoutput-digital.jpg|600px|center]]
 
'''“延时”程序块'''
 
<br>
 
“延时”程序块位于“控制”选项卡中。
 
[[File:mixly-delay-where.jpg|600px|center]]
 
“延时”程序块说明
 
“延时”程序块可以让程序原地踏步一定时间后在执行下一步程序。在执行这个程序块的时候不能做其他事情,直到时间结束为止。
 
[[File:mixly-delay-explain.jpg|600px|center]]
 
===编程思路===
 
如果想实现单色LED灯闪烁的效果,就要用“模拟输出”程序块控制单色LED灯的亮度,用“延时”程序块控制间隔时间。通过不同的亮度和间隔时间模拟灯光闪。
 
 
[[File:mixly-ctrl-ledblink.jpg|600px|center]]
 
[[File:mixly-ctrl-ledblink.jpg|600px|center]]
===开始编程===
+
===Programming===
'''1.LED灯以较暗的亮度点亮1秒'''
+
'''1.LED is on for 1s in weaker brightness. '''
 
<br>
 
<br>
将“模拟输出”的管脚号改为6,赋值为120;延时时间设为1000毫秒,即1秒。
+
Change the pin of "analog output" into 6, and assign 120 to it; set the delay to 1000ms, namely 1s.
 
[[File:mixly-ctrl-ledblink-code1.jpg|600px|center]]
 
[[File:mixly-ctrl-ledblink-code1.jpg|600px|center]]
'''2.LED灯以较亮饿的亮度点亮1秒'''
+
'''2.LED is on in relatively bright light for 1s'''
 
<br>
 
<br>
将“模拟输出”的管脚号改为6,赋值为240;延时时间设为1000毫秒,即1秒。
+
Change the pin of “analog output” into 6, and assign 240 to it;set the delay time to 1000ms, namely 1s.
 
[[File:mixly-ctrl-ledblink-code2.jpg|600px|center]]
 
[[File:mixly-ctrl-ledblink-code2.jpg|600px|center]]
3.两步骤程序块连接在一起,选择好核心和端口下载程序。
+
3.Link the two program blocks together, and choose the core and port to download the program.
 
<br>
 
<br>
 
<br>
 
<br>
'''测试结果:'''
+
'''Test the result: '''
 
<br>
 
<br>
上传成功后,观察到LED灯忽暗忽亮的闪烁起来,我们的火警指示灯就大功告成啦!
+
After upload, if you see the LED flash dark and bright, that is saying our fire alarming light is done!
 
<br>
 
<br>
用乐高搭建一个紧急出口,将我们的火警指示灯安装好,向小伙伴们介绍安全逃生的知识。
+
Set up an emergency exit with Lego, and install our light on it, then introduce the escape safely knowledge to your friends.
 
[[File:anywhere_light_blink.jpg|600px|center]]
 
[[File:anywhere_light_blink.jpg|600px|center]]
  
==我们还能怎么玩==
+
==Can It Be Played in Another Way==
Q:可不可以设置三种亮度的火警灯,同时让灯光闪烁得更快一些呢?这样更容易引起人的注意。
+
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.
 
<br>
 
<br>
A:这很简单,只需要在0-255之间设置3个亮度,同时每个亮度持续时间更短一些就可以了。
+
A: It is very easy. Just set 3 brightness between 0-255 and make every brightness last shorter time.
 
[[File:mixly-ctrl-ledblink-code3.jpg|600px|center]]
 
[[File:mixly-ctrl-ledblink-code3.jpg|600px|center]]
  
==Q&A==
+
==FAQ==
*Hub的模拟输出管脚只有6/7,10/11口吗?
+
*Are the analog output pins of Hub only  6/7, and 10/11?
**如果使用Core作为核心,那就只能用6,7,使用输出模拟信号(0-255)的设备必须连接到Hub的6/7,10/11接口之一,因为模拟信号其实是后台程序用数字信号模拟出来的,所以也只能用双数接口,在Mixly中模拟输出管脚只能选择6、10。
+
**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支持端口'''
+
'''PWM supporting port of Core'''
* '''Core'''  PWM支持,共6个:
+
* '''Core'''  PWM supporting, totally 6:
** 在模块上标示为 分别为D3,D5,D6,D9,D10,D11
+
** On the module labeled D3, D5, D6, D9, D10, D11
** 详情请参阅'''[http://www.arduino.cc/en/Reference/AnalogWrite analogWrite()]'''函数。
+
** For details, please refer to: '''[http://www.arduino.cc/en/Reference/AnalogWrite analogWrite()]'''
* Core+ PWM支持,共8个:
+
* Core+ PWM supporting, totally 8:
** 在模块上标示为 分别为D7,D8,D9,D10,D12,D13,D22,D23
+
** On the module labeled D7, D8, D9, D10, D12, D13, D22, D23
** 详情请参阅'''[http://www.arduino.cc/en/Reference/AnalogWrite analogWrite()]'''函数。
+
** For details, please refer to: '''[http://www.arduino.cc/en/Reference/AnalogWrite analogWrite()]'''
  
 
|}
 
|}

Latest revision as of 10:24, 9 October 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

Required Program Block

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()