WEBVTT

00:00.150 --> 00:06.900
This is the solution of the previous activity where you have to pour the energy when the buttons pressed

00:07.140 --> 00:09.930
and power of the ready when the button is not pressed.

00:10.440 --> 00:12.690
So first things first.

00:13.020 --> 00:16.410
We are going to initialize here the beams.

00:16.650 --> 00:21.960
And before doing that, we are going to use define for being.

00:21.960 --> 00:28.890
So this is still PIN number 11 and another defined for button.

00:30.160 --> 00:32.530
Bean, which is number two.

00:32.890 --> 00:37.670
OK, so for every bean you are going to use in your speech, in your program here.

00:38.140 --> 00:41.530
Well, you can just add a define for each bean.

00:42.750 --> 00:54.450
And then in the set up, so here we're going to use spin mode to initialize the energy in order to output

00:54.570 --> 00:59.800
mode and in mode by the button appear.

01:01.750 --> 01:03.820
Or input mode.

01:04.210 --> 01:09.640
OK, so here the order is not really important, you just initialized all the feeds so you could initialize

01:09.640 --> 01:11.650
the energy first on the button first.

01:11.670 --> 01:12.390
It doesn't matter.

01:12.760 --> 01:19.200
And now that the pins are set up after directly after the pin, also here in the set up for your uncle

01:19.220 --> 01:27.100
in the loop function, we can start to rate the button state and we can start to control the the in

01:27.100 --> 01:27.610
the loop.

01:27.790 --> 01:36.370
What I'm going to do, I'm going to write if digital read button in.

01:36.880 --> 01:43.750
But if this is equal to high, OK, and make sure you use to equal sine OK.

01:43.750 --> 01:47.950
If you just use one equal sign you may have some weird arrows here.

01:49.110 --> 01:56.730
So to equal sign, if the balloon is priced so we can read this line as if the balloon is priced, then

01:56.730 --> 01:59.100
we are going to own the entity.

01:59.100 --> 02:00.270
So digital.

02:01.550 --> 02:06.050
Right, and then we've hired.

02:07.250 --> 02:20.270
And as if the button is not pressed, we're going to do digital right in with No.

02:21.690 --> 02:23.380
All right, and that's about it.

02:23.400 --> 02:29.790
So now let's verify, let's combine I'm going to name it activity three.

02:33.720 --> 02:40.170
OK, Don, combining so we don't have any Tarong and I'm going now to upload it occurred to out in the

02:40.230 --> 02:40.580
world.

02:40.610 --> 02:43.010
So again, make sure the board is correctly connected.

02:43.320 --> 02:44.880
I applaud the code.

02:45.390 --> 02:49.850
And now so you should see hear the energy.

02:49.860 --> 02:51.040
So nothing happens.

02:51.640 --> 02:53.190
It is pulled off.

02:53.490 --> 03:02.580
But actually the edit is put off because we are in the end here of the if OK, because the button state

03:02.580 --> 03:03.360
is low.

03:03.360 --> 03:05.370
So we pull off the.

03:06.110 --> 03:14.370
No, I'm going to press the pause button here and you can see the 3D both on OK, I release the push

03:14.480 --> 03:19.200
button and a press error I press.

03:20.200 --> 03:27.310
I really and every time I press, the energy would be put on and every time I release or every time

03:27.310 --> 03:30.380
the button is, the press diary is put up.

03:31.420 --> 03:31.840
All right.

03:31.840 --> 03:35.450
So that's the end of this activity again with this activity.

03:35.470 --> 03:41.650
You could have the first real example of how you can combine different hardware components.

03:41.690 --> 03:48.010
OK, for example, with input components and output components to make a smarter program which will

03:48.010 --> 03:52.120
take decisions depending on the status of your sensors.

03:52.330 --> 03:56.940
And here you can see a nice combination of digital and digital right functions.
