Activa JavaScript para disfrutar de los vídeos de la Mediateca.
Arduino: serial I (native speaker) - Contenido educativo
Ajuste de pantallaEl ajuste de pantalla se aprecia al ver el vídeo en pantalla completa. Elige la presentación que más te guste:
Hello. In this exercise we are
00:00:00
going to learn something new about the
00:00:07
usb. The usb is the
00:00:09
wire we use to connect the arduino
00:00:11
board to the computer
00:00:13
so we already know that we can
00:00:15
use this wire to program the arduino
00:00:17
board from the computer and we also
00:00:19
know that we can use this connector
00:00:22
to provide energy from the computer but
00:00:24
there is another possibility we can use
00:00:27
this connector to send and receive information
00:00:29
from the computer to the arduino board
00:00:32
and vice versa from the hardware
00:00:34
aboard to the computer
00:00:36
so in this exercise here we have
00:00:38
the arduino board we have the
00:00:41
protoboard
00:00:43
and we have the voltage divider now
00:00:45
the idea is really simple we already
00:00:48
know how to read an analog value
00:00:50
using a zero and the voltage divider
00:00:52
so we are going to program the
00:00:56
circuit this way so let me show
00:00:57
you the code
00:00:59
we are reading the analog pen or
00:01:05
connector a zero we store it in
00:01:07
a variable called a
00:01:10
and that the new block is the
00:01:13
second one this blue one
00:01:16
you will find it here at the
00:01:19
top in the blue library
00:01:21
and it's this blog called print series
00:01:27
monitor and the interesting thing here is
00:01:30
that we are going to print a
00:01:33
okay so then we have this weight
00:01:36
block
00:01:38
and so what is what is this
00:01:40
blue one mean while the series monitor
00:01:41
is a tool the computer has to
00:01:43
receive information from the arduino board
00:01:45
so here in the simulator
00:01:50
the series monitor is down here so
00:01:53
when we start the simulation down here
00:01:57
we will be reading values ok the
00:02:00
values that are coming from a zero
00:02:02
if i move the divider closer to
00:02:05
five volts to one thousand twenty three
00:02:07
you can see that the values become
00:02:10
higher
00:02:12
if we move move it closer to
00:02:14
zero toward the left it becomes lower
00:02:16
but using the simulator here doesn't give
00:02:20
you the whole idea about the program
00:02:23
so I am going to take this
00:02:25
code
00:02:28
and we can stop the simulation
00:02:30
so just the code I'm going to
00:02:39
take the text right and copy and
00:02:41
paste it
00:02:43
into the arduino id the program you've
00:02:45
already seen that so I paste it
00:02:48
here and check it up here
00:02:51
and it works fine and then we'll
00:02:55
upload this to the arduino board because
00:02:57
my arduino board on the screen is
00:03:00
connected to the computer through the usb
00:03:02
wire that is back here can you
00:03:04
see it
00:03:06
so I'm going to send this program
00:03:10
the one that we programmed with the
00:03:12
blocks to the arduino
00:03:14
so we will read from a zero
00:03:17
this one and we will also have
00:03:19
the five volts and the ground
00:03:21
so the arduino board will read the
00:03:26
information sent by a zero so I
00:03:28
will send it or click upload and
00:03:31
now it works
00:03:34
now the series monitor in this program
00:03:36
can be found up here if we
00:03:39
click on tools and then down to
00:03:41
series monitor
00:03:44
let's just make it a little bit
00:03:47
smaller
00:03:48
so right now we're reading seven hundred
00:03:51
sixty six
00:03:53
if I turn this real voltage divider
00:03:55
higher and move it a little bit
00:03:57
to the left or even all the
00:04:01
way it'll go to the maximum value
00:04:02
it'll read the highest if I move
00:04:05
it to the to the right it
00:04:07
becomes lower and lower
00:04:08
and it's reading lower so this is
00:04:12
really interesting because we are taking this
00:04:13
electronic component and the value is sent
00:04:16
using the usb here and sending it
00:04:19
to the computer and the computer can
00:04:22
read it
00:04:25
so this is the amazing thing about
00:04:27
this exercise
00:04:29
so for now let's just leave this
00:04:36
simulation here and go back to the
00:04:38
circuit this is the exercise you have
00:04:40
to do you are going to copy
00:04:44
this voltage divider so place another one
00:04:45
next to it for instance with the
00:04:48
ground connected to the ground the five
00:04:50
volts wire connected to the five volts
00:04:53
and
00:04:56
here instead of connecting to a zero
00:04:56
which is already being used you're going
00:04:59
to connect to a one so you
00:05:01
will read two values and so the
00:05:03
same way you're reading one value in
00:05:05
the code you will read another one
00:05:08
in another variable for instance you can
00:05:10
make it be
00:05:13
and you will send both values to
00:05:15
the series monitor with a and then
00:05:16
again with b
00:05:19
then you await one second because it
00:05:22
means you read and wait one second
00:05:24
until the next one starts reading
00:05:27
and then you will also use the
00:05:30
if block to compare like we've done
00:05:31
now there will be three possibilities if
00:05:35
a is higher than b
00:05:38
and you will use the blue block
00:05:41
to say if a is
00:05:43
higher than b
00:05:44
and another one for if they are
00:05:47
equal so if a equals b and
00:05:49
you will send with the blue block
00:05:52
a equals b
00:05:54
and the third one if b is
00:05:57
higher than a
00:05:58
you will send that to the series
00:06:01
monitor with blue if b is higher
00:06:03
than a so you will complete this
00:06:05
exercise with another variable and you will
00:06:07
check three conditions and you will also
00:06:09
send the three conditions to the usb
00:06:12
connector and series monitor okay that is
00:06:14
all for this
00:06:20
exercise good luck
00:06:21
- Idioma/s:
- Autor/es:
- David Gonzalez Arroyo, Alyssa Fantel
- Subido por:
- David G.
- Licencia:
- Reconocimiento - No comercial - Compartir igual
- Visualizaciones:
- 107
- Fecha:
- 13 de marzo de 2022 - 20:10
- Visibilidad:
- Público
- Centro:
- IES MARIE CURIE Loeches
- Duración:
- 06′ 25″
- Relación de aspecto:
- 1.78:1
- Resolución:
- 1920x1080 píxeles
- Tamaño:
- 74.43 MBytes