Saltar navegación

Activa JavaScript para disfrutar de los vídeos de la Mediateca.

Arduino: serial I - Contenido educativo

Ajuste de pantalla

El ajuste de pantalla se aprecia al ver el vídeo en pantalla completa. Elige la presentación que más te guste:

Subido el 10 de enero de 2021 por David G.

183 visualizaciones

Descargar la transcripción

Hello, in this exercise we are going to learn something new about the USB. 00:00:00
The USB is the wire we use to connect the Arduino board to the computer. 00:00:06
We already know that we can use this wire to program the Arduino board from the computer 00:00:10
and we also know that we can use this connector to provide energy from the computer. 00:00:17
but there is another possibility we can use this connector to send and receive information from 00:00:23
the computer to the Arduino board and vice versa from the Arduino board to the computer okay 00:00:30
in this exercise here we have the Arduino board we have the protoboard and we have a voltage 00:00:36
divider okay the idea is really simple we already know how to read an analog value using 00:00:44
A0 and using the voltage divider, okay? 00:00:53
And we are going to program the circuit this way. I want to show the code to you. 00:00:58
We are reading the 00:01:03
analog pin, analog connector A0, and we store it in 00:01:05
a variable called A, okay? We already know how to use it. 00:01:09
The new block is the second one, the blue one. 00:01:13
You have it here in the 00:01:19
blue library and is this block. Imprimir en monitor serie. The interesting thing 00:01:21
here is that we are going to print A. But what does it mean? And then we will use 00:01:29
a weight. What does it mean Imprimir en monitor serie? Monitor serie, series 00:01:34
monitor, is a tool the computer has to receive information from the Arduino 00:01:39
board. Here in the simulator the series monitor is here, so it means that if we 00:01:46
start the simulation here we will be reading values, the values we read from 00:01:54
A0. If I move this one closer to 5 volts to 1023 you can see that the 00:02:01
values become becomes higher. If we move it closer to 0 this way it becomes 00:02:09
lower but I think that using the simulator doesn't give you a whole idea 00:02:16
about the about the program so that's why I'm going to take the code I'm sorry 00:02:24
look is stop simulation we are going to take this text I copy it and I'm going 00:02:32
paste it here in the Arduino IDE, you already know it, so I paste it, I check it, okay, it works fine, 00:02:42
and I'm going to upload to the Arduino board, because my Arduino board is connected to the 00:02:51
computer through the USB wire that is here, here, the USB wire, okay, can you see it? So I'm going 00:02:56
to send it the program, this one, the one we have programmed with the blocks to the real Arduino, 00:03:05
So we will read from A0. A0 is this one. And we also have 5 volts and ground. So they are doing a board. We read the information sent by A0. So I will send it. Upload. Uploading. Okay, now it works. 00:03:11
OK, fine, perfect. Where is the series monitor here? 00:03:31
The series monitor is here. We click on tools and then monitor series. 00:03:37
We want to make it a little bit smaller. 00:03:42
Now we are reading 766. 00:03:46
What happens if I turn this one? This voltage divider is higher. 00:03:52
And I move it a little bit to the left, it's even higher. 00:03:58
This is the maximum value. 00:04:03
What happens if I move it to the right? 00:04:05
It becomes lower and lower and lower. 00:04:08
So I think this is really, really interesting. 00:04:11
We are taking this electronic component and the value is sent using the USB, 00:04:13
USB here, and it's sent to the computer and the computer can read it. 00:04:23
Okay? So this is the amazing thing about this exercise. 00:04:27
Okay? So let's stop the simulation here, 00:04:31
and let's go back to this circuit. 00:04:35
This is the exercise you have to do. You are going to copy 00:04:39
this voltage divider, you are going to place another one here, for instance, 00:04:43
the ground connected to the ground, the 5V wire connected to the 00:04:47
5V wire, and here instead of 00:04:51
connected to A0 that has been already used, you are going to connect to A1. 00:04:55
So you will read two values. And so the same way 00:04:59
I'm sorry, just blocks. The same way you are reading one value 00:05:02
you will read another one in another variable, for instance B, and 00:05:06
you will send both values to the 00:05:10
series monitor, in Premiere Monitor Serie A, in Premiere Monitor Serie B. 00:05:14
You will wait one second, because it means you read and you wait 00:05:19
you wait one second until the next reading, and you also use the if block to compare. 00:05:22
And there will be three possibilities. If A is higher than B, you will also use this blue block 00:05:30
to imprimir en monitor serie to send A is higher than B, if A is higher. 00:05:36
Another one, if they are equal, if A equals B, you will send, using this blue block, A equals B. 00:05:42
and a third one is B is higher than A, you will type here, 00:05:51
you will send through the series monitor, B is higher than A. 00:05:55
So you will complete this exercise with another variable 00:06:00
and you will check three conditions and you will also send 00:06:04
the three conditions using the USB connector, okay? 00:06:08
The serial monitor. 00:06:12
Okay, and that's all, I think the exercise is not difficult. 00:06:14
Good luck. 00:06:18
Autor/es:
David Gonzalez Arroyo
Subido por:
David G.
Licencia:
Reconocimiento - No comercial - Compartir igual
Visualizaciones:
183
Fecha:
10 de enero de 2021 - 18:34
Visibilidad:
Público
Centro:
IES MARIE CURIE Loeches
Duración:
06′ 21″
Relación de aspecto:
1.78:1
Resolución:
1920x1080 píxeles
Tamaño:
24.46 MBytes

Del mismo autor…

Ver más del mismo autor


EducaMadrid, Plataforma Educativa de la Comunidad de Madrid

Plataforma Educativa EducaMadrid