剧集 | 英国皇家科学院圣诞讲座:让火花飞(2014) | 导航列表
里面没有白炽灯需要的那种气体
So there's no gas in it, like being candescence light bulb needs.
你会注意到的是
What you will notice about this is
可能想不到灯泡里会有这个部分
what you might not expect in a light bulb is this part.
这是一个无线电接收器
This is the radio receiver.
很像手环上的那种
It is like the ones we have in our wristbands.
上面还有无线网络
This has a Wi-Fi network on it.
无线网络将会传送
So the Wi-Fi network will send information
灯泡的发光信息
about the bulb's brightness
而我们甚至还可以改变灯泡的颜色
and we can even change the colour of these bulbs as well.
因为它是无线电接收器
And because it has a radio receiver
所以我们可以无线控制
we can do it wirelessly,
用手♥机♥的应用软件进行操作
so we can do it from a mobile phone app.
现在一切看起来都很完美
These seem perfect.
我们有182只能够无线控制的灯泡
We have got 182 bulbs that we can wirelessly control,
可以把它们装在大楼的台灯里
so we can put them in our lamps, in our building,
通过无线控制它们
and control them wirelessly in the windows.
窗户会透出不同的颜色
It would make the windows different colours,
并且根据我们的要求马上做出反应
so anything we want just in an instant.
我们可以发出一条无线信息
And we can send a wireless message
它会从一只灯泡传到另一只灯泡
that would pass that message to the next bulb,
再传到下一只
which would pass it to the next bulb,
不停传下去
which would pass it to the next.
这就叫做网状网络
That is called a mesh network.
可以确保不会遗漏任何一只灯泡
It would make sure that no bulb is actually forgotten.
好了 硬件设备就绪
So, hardware done!
我越来越有信心了
I'm getting more confident on this.
就像你们开始时一样信心十足
I'm getting up to where you were at the beginning.
准备好硬件设备
So we have done the hardware.
下面要进行第二步
But we need step two,
我们需要去控制 需要软件
we need to control, the software.
这就需要编写一些程序
So, we need to write some programming.
让我们来写代码吧
Let's do some coding.
我知道这是圣诞科学讲座
Now, i'm aware these are the Christmas Lectures
可我们还没弄炸任何东西呢
and we haven't blown anything up yet, have we?
这可不太应景
That seems wrong.
让我们欢迎英国广播公♥司♥儿童频道
So, please welcome CBBC
常驻爆破专家
resident explosives expert,
芙兰·斯科特
Fran Scott.
很高兴见到你
Nice to see you.
我知道我们会用到很多气球
I understand we are going to have a selection of balloons.
是的
We are.
当然 我们还需要一些计算机设备
Of course, we have to have some hardware, as well.
用来运行软件
To be able to use our software.
慢慢来
Slowly coming on.
你能给大家介绍一下吗
If you just talk us through what is happening here.
这些不只是普通的气球
These aren't just ordinary balloons.
它们是易爆气球
These balloons are explosive balloons.
很好
Excellent.
它们充满了高度易燃气体
They are full of a highly flammable gas,
爆♥炸♥后 不仅会发出响声
so when we let them off, they won't just pop,
还会燃起小火球
there will be small fireballs.
听起来不错
Sounds good!
好的 我们要做的就是
Ok. What we are going to do,
给这些气球编程
we will code those fireballs.
这些程序的作用就是
because all that coding does,
告诉计算机如何将输入信息
it is a way to tell a computer how to take an input
转化为输出信息
and convert into some kind of output.
好的 怎样开始编写这种代码呢
Ok. How do you start writing code like that?
是这样 开始时 要有输入信息
Well, the thing is, to start with, you need input.
通常代表爆♥炸♥的输入
So inputs usually for an explosion
是一个大红色按钮
are a big red button,
这里我们用一个小的蓝色按钮表示
here we have got us a small blue button.
我们喜欢与众不同
We like to be different. That's good.
那就是我们的输入
That will be our input.
我们要给输入信息编程
We need to code our input.
大家现在看一下屏幕
So if we look up at the screen now,
那是我们要用的代码
that is our code that we will use
-用它来告知计算机该做什么 -好的
- to tell the computer what to do. - OK.
这是Python 一种编程语言
It is in Python, a programming language.
我们看一下这里的白色文本
If we look here at that white text,
写的是蓝色按钮被分配了一个数字
it says the blue button is allocated a number.
而那个数字代表我们这个
And that number refers to digital switches
小电脑中的数字开关
inside our small computer
我们就用这些数字来
because this is what we are going to use
引爆指定气球的
to set the explosions off.
好吧
Ok. Right.
不同的数字代表不同的开关
Different numbers mean different switches.
好的 懂了
Right. Got it.
蓝色按钮 对应数字22
Blue button, 22,
我们要做的就是
and all we need to do
在这段代码中
is go down to this part of the code
将"选择输入"的地方
where it says "Input chosen".
删除并改写成
We delete "Input chosen"
刚才的那个数字22
and we put in our number - 22.
-很简单的 -不错嘛
- Simple. - That is good.
我们已经有了一个输入
I see we have got an input and that is good.
现在我们需要输出
Now we need output.
我猜这些气球就是输出吧
I'm guessing the balloons are the output?
是的 输出可以显示在屏幕上
They are. You can have an output that is on the screen,
也可以是一系列爆♥炸♥的气球
or you can have an output that is exploding balloons.
太棒了 我就是冲着爆♥炸♥气球来的
Right, excellent, I come for exploding balloons
我们就喜欢这个 太好了
We like it, good.
我们程序使气球每隔一秒爆♥炸♥一个
These are programmed to go off one second after each other.
所以我们需要
So we need to order
-给它们指定一个爆♥炸♥的顺序 -是的
- which way those balloons are going to go off? - Exactly.
我们还没给编码顺序呢...
We haven't programmed that bit yet...
好的 我想可以由现场观众来决定...
Okay, so I think those guys should...
-我也这么想的 -就这么办
- I, I think we should do that. - We should.
我们来决定哪个颜色的气球最先爆♥炸♥
We need to choose which colour balloon goes off first.
我们有黄色 蓝色 绿色
We have got yellow, blue, green.
想一想你想要哪种颜色的最先爆♥炸♥
so, have a think about which one you want it to go off first,
想要黄色气球先爆♥炸♥的
if you want the yellow one to go off,
现在喊"是的"
shout yes, now.
是的
Yes.
蓝色呢
Blue.
是的
Yes.
绿色呢
Green.
是的
Yes.
-是绿色呢 -没错是绿色
- Green. - Green
我要做的就是看看
All I need to do is to look at the number
分配给绿色的数字 也就是13
the green is allocated, which is 13.
然后把它填写到"气球1"这里
and I put that here, where it says "balloon one"
我只要在这里输入数字13
I just need to put in number 13 there
这就打开了输出
and that switches the output on
然后 就像前面打开开关一样
but then, just like you switch it before
我需要在这里把它关掉
I need to switch it off again.
所以这里我再输入13
So here I put 13 again.
第一个气球就设置好了
That's the first balloon.
现在我们需要设置第二个气球
We need the second one now.
-对呀 -好吧
- We do. - Okay
我们还剩下黄色和蓝色
So, we've got yellow, blue left.
如果你想要黄色第二个爆♥炸♥
If you want yellow to go off second,
现在喊"是的"
shouted "yes", now.
是的
Yes.
蓝色呢
Blue.
是的
Yes.
肯定是蓝色的人多些
Bule, definitely blue.
蓝色对应数字12
Blue is number 12.
我现在来写代码
I'm going to code that.
我不知道黄色有什么不对
I don't know what's wrong with yellow.
剧集 | 英国皇家科学院圣诞讲座:让火花飞(2014) | 导航列表