1 00:00:00,000 --> 00:00:09,640 Oh, oh, oh, oh, oh, oh, oh Shadows come and go 2 00:00:09,640 --> 00:00:17,600 Let the daylight show Hold me close, don't let go 3 00:00:17,600 --> 00:00:24,539 In this moment glow Heartbeat like a drum 4 00:00:24,539 --> 00:00:44,340 This is one of the end-of-course projects that we have, there is another one that we will see next 5 00:00:44,340 --> 00:00:53,579 and this is something as simple as seeing how a plate, an electronic circuit with its connections 6 00:00:53,579 --> 00:01:01,020 and provides current to an engine that will lift a little person if a little person is simulated 7 00:01:01,020 --> 00:01:08,760 and will do it automatically depending on the light it receives in such a way that if we cover the light 8 00:01:08,760 --> 00:01:17,819 the blind will open and if we uncover the light the blind closes for this we have used a 9 00:01:17,819 --> 00:01:28,260 bit block board that has the light sensor connected to the sensor there and then here a 10 00:01:28,260 --> 00:01:34,540 motor we are going to test it as the board is already programmed we do not even need to connect it 11 00:01:34,540 --> 00:01:39,540 to a computer so that with some batteries that give current to the board and this to the 12 00:01:39,540 --> 00:01:44,519 motor with all that the installation already works we are going to do a small test we cover the light 13 00:01:44,519 --> 00:02:01,260 and see what it does, it reaches the end, now at the moment we uncover it should go down and that is 14 00:02:01,260 --> 00:02:06,780 all, then we will see how the program has been designed, this has a program that is the one that 15 00:02:06,780 --> 00:02:14,219 indicates in what direction the motor has to move, the axis of the motor and both to open and 16 00:02:14,219 --> 00:02:20,120 to close and we are also indicating to it, we are going to indicate in what conditions it should do it and 17 00:02:20,120 --> 00:02:24,419 and how long the motor should be rotating in one direction or in another. 18 00:02:24,419 --> 00:02:26,419 As for the conditions, it is clear. 19 00:02:26,419 --> 00:02:31,319 When it receives light, it rotates in one direction and when it does not receive it, it must rotate in another direction. 20 00:02:31,319 --> 00:02:36,819 And then the plate also checks the state in which the ring is. 21 00:02:36,819 --> 00:02:42,419 If the ring is already raised, logically, although we cover here, 22 00:02:42,419 --> 00:02:46,419 the motor should not rotate further up. 23 00:02:46,419 --> 00:02:49,620 And when it is lowered, it should not go down further. 24 00:02:49,620 --> 00:02:53,620 That is this little project at the end of the course. 25 00:02:54,620 --> 00:02:59,620 This is the program that manages the movement of the motor. 26 00:02:59,620 --> 00:03:07,620 This program is made with blocks and within a generic application that is BitBlock. 27 00:03:07,620 --> 00:03:13,620 BitBlock allows us to place the board with which we are working 28 00:03:13,620 --> 00:03:17,620 and the elements that are going to intervene. 29 00:03:17,620 --> 00:03:25,620 Here is the motor that will allow us to turn it in one direction or another and at the bottom we have the light sensor. 30 00:03:25,620 --> 00:03:37,620 How is it programmed? It has been programmed in such a way that initially for this program we declare some variables 31 00:03:37,620 --> 00:03:43,319 some variables that will be called state, it will indicate if the pressure is already up or down 32 00:03:43,319 --> 00:03:52,419 and the sensor, initially we give it value 0 and throughout the program we will give each one its value 33 00:03:52,419 --> 00:03:57,520 we start by saying that the value that makes a reading of the sensor 34 00:03:57,520 --> 00:04:03,120 and for that we say that the sensor variable is going to be worth the result of that reading 35 00:04:03,120 --> 00:04:11,620 that reading is in a range of values ​​that we are going to use to compare 36 00:04:11,620 --> 00:04:19,399 next we send it to wait 500 milliseconds, that is, half a second, so that it does not do a 37 00:04:19,399 --> 00:04:24,259 reading immediately afterwards, if not, it may be that it does too many readings at 38 00:04:24,259 --> 00:04:29,959 the same time and then the program can give us errors here we establish a loop if a 39 00:04:29,959 --> 00:04:36,360 comparativa y aquí abajo otro vamos a ver qué hace dentro de ese bucle dentro de ese bucle le 40 00:04:36,360 --> 00:04:45,199 decimos que si la variable sensor es la que acaba de leer aquí arriba es mayor o igual que 75 y 41 00:04:45,199 --> 00:04:56,600 además la variable estado es exactamente igual a 1 entonces ejecutamos que el motor gire en 42 00:04:56,600 --> 00:05:01,160 clockwise. For how long is that motor going to rotate that will raise the pressure? 43 00:05:01,160 --> 00:05:08,720 Around here, 4 seconds. And then the motor stops. And the variable state, since it has changed and 44 00:05:08,720 --> 00:05:15,639 now the pressure would already be up, the variable would go to zero. Here we are with the 45 00:05:15,639 --> 00:05:22,399 same loop, exactly the same, only the parameters change. If you look here we have a 46 00:05:22,399 --> 00:05:31,579 value of 75 and here one of 25 and here the state variable was in 1 and here it is in 0 everything else 47 00:05:31,579 --> 00:05:37,519 is almost almost the same here for example the engine what it does is turn in the opposite direction to the previous one 48 00:05:37,519 --> 00:05:44,660 here it was clockwise and here counterclockwise its waiting time which is the same in both cases the 49 00:05:44,660 --> 00:05:51,740 of the motor and we change the variable state again that already here it started at 0 the variable 50 00:05:51,740 --> 00:06:20,389 we put it at 1 for the rest that is all this is the project that we have done for the end of the course 51 00:06:20,389 --> 00:06:26,569 which is a project for a barrier that works through a distance sensor at the 52 00:06:26,569 --> 00:06:33,629 moment when an object is placed in front of the barrier, it opens, changes the light, 53 00:06:33,629 --> 00:06:40,810 passes through the green light and then after a few seconds the barrier will close 54 00:06:40,810 --> 00:06:47,910 if we want to see it in operation only by interrupting it, it is more while the vehicle 55 00:06:47,910 --> 00:06:54,850 is here the barrier will not go down because the sensor is detecting that there is something in front and it will not go down 56 00:06:54,850 --> 00:07:03,129 but when it finishes passing the barrier goes down this project has been a matter of three phases 57 00:07:03,129 --> 00:07:11,410 we said that one is the design of the pieces that make up the barrier the supports for 58 00:07:11,410 --> 00:07:18,129 the different elements that has been designed using pinker cat which is a design program 59 00:07:18,129 --> 00:07:27,069 and then it has been printed with a three-dimensional printer that is a little 60 00:07:27,069 --> 00:07:33,370 slow but it has taken it out, it has taken it out well, then our partner Carlos has assembled everything 61 00:07:33,370 --> 00:07:39,629 and he has placed the different elements inside, he has a plate that is a circuit that 62 00:07:39,629 --> 00:07:47,589 plate has a programming that plate is called bit block and that plate allows us as we see 63 00:07:47,589 --> 00:07:55,189 here in a different way we have the plate in the center and the motor the distance sensor 64 00:07:55,189 --> 00:08:01,329 one light and another light and how is all this programmed because in a quite simple way 65 00:08:02,529 --> 00:08:08,529 this is simply a program in which some variables are declared in this case the 66 00:08:08,529 --> 00:08:15,529 distance variable then we also give some initial instructions so that the red light is turned on, 67 00:08:15,529 --> 00:08:22,850 put the green one and move the motor to a certain position and finally we have 68 00:08:22,850 --> 00:08:33,230 what would be the loop of the program itself that loop what it does is to see here now 69 00:08:33,990 --> 00:08:40,409 if there is a line that is not right what it does is establish the initial variables and make a 70 00:08:40,409 --> 00:08:48,210 series of checks if the distance variable is less or equal to a given reading what it will do 71 00:08:48,210 --> 00:08:56,830 will be to turn on the led and turn off the other led move the servo to another position and wait five 72 00:08:56,830 --> 00:09:02,649 seconds and in case the distance is greater because the vehicle has already passed because it has 73 00:09:02,649 --> 00:09:08,929 nothing in front just do the opposite place the servo in another position turn on the red light and 74 00:09:08,929 --> 00:09:14,889 turn off the green light that is the plan that is quite simple and that sometimes gives a 75 00:09:14,889 --> 00:09:17,490 little war 76 00:09:25,299 --> 00:09:27,379 from the audience