Activa JavaScript para disfrutar de los vídeos de la Mediateca.
Arduino: Analog Output (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 going
00:00:02
to use the same circuit that we
00:00:05
used in the previous exercise so you
00:00:07
can see I have a voltage divider
00:00:10
connected the same way we connected it
00:00:11
the other day and we are reading
00:00:13
from five volts to zero volts using
00:00:16
the
00:00:19
zero analog connector
00:00:20
and we have the LED
00:00:23
connected to the arduino board the usual
00:00:26
way
00:00:28
but there is something different instead of
00:00:29
connecting it to number thirteen we are
00:00:32
connecting it to number eleven you can
00:00:35
see if i zoom in that numbers
00:00:38
eleven ten nine six five and three
00:00:40
they all have a line in front
00:00:45
of their number it means that these
00:00:46
connectors are different
00:00:48
and so these numbers can provide digital
00:00:49
values the same way we have been
00:00:52
doing during the previous days with the
00:00:54
high and low digital values but these
00:00:56
six connectors the ones with the line
00:00:59
in front of the numbers these can
00:01:01
also provide analog values
00:01:04
so this means that if we send
00:01:08
one volts two volts three volts we
00:01:11
could send one and a half two
00:01:14
and a half two point four zero
00:01:16
point three three point six whatever we
00:01:19
want and if this LED is connected
00:01:21
to eleven for instance it means that
00:01:24
we
00:01:27
we'll be able to provide any voltage
00:01:27
amount we want to control the intensity
00:01:30
of the LED so we will be
00:01:32
able to decide if it will shine
00:01:34
brighter or less bright
00:01:36
so let's have a look at the
00:01:45
simulation I will show you the code
00:01:46
later
00:01:49
if we're reading zero using the
00:01:53
zero connector eleven doesn't change it doesn't
00:01:56
send anything to the LED so it
00:01:59
won't shine
00:02:01
if we move it a little bit
00:02:05
higher it means we're reading a number
00:02:07
higher than zero and as you can
00:02:09
see the LED is shining just a
00:02:11
little bit more
00:02:13
now if we move it more we
00:02:15
read a number even higher the LED
00:02:17
will shine brighter and the higher the
00:02:19
number we read the brighter it will
00:02:22
shine this is the brightest value on
00:02:24
five
00:02:26
so it's the brightest back to zero
00:02:31
off
00:02:33
back to five so you can see
00:02:35
the range of values we're reading and
00:02:36
sending to the LED
00:02:38
now let's stop the simulation
00:02:43
and before we have a look at
00:02:47
the code we need to take into
00:02:48
account that a zero although it reads
00:02:50
analog values the arduino board will work
00:02:53
using integral numbers do you remember that
00:02:56
the analog input reads numbers from zero
00:03:00
to one hundred and two we studied
00:03:02
it in
00:03:05
the previous exercise means that we're going
00:03:05
to use one thousand twenty four values
00:03:08
this number zero is related to zero
00:03:13
volts and number twenty three number one
00:03:16
thousand twenty three is related to five
00:03:19
volts for instance if we have five
00:03:21
thousand and twelve that one in the
00:03:25
middle then we will be reading two
00:03:28
and a half volts it's the value
00:03:31
in the middle
00:03:32
so there's a proportional relationship between the
00:03:39
number we use and the voltage were
00:03:41
reading when we use these numbers as
00:03:43
output values we're going to use a
00:03:45
lower range of values we're going to
00:03:47
use a range of two hundred and
00:03:50
fifty six we will use numbers from
00:03:51
zero to two hundred and fifty five
00:03:54
so zero is real
00:03:57
rated to zero volts two hundred and
00:03:58
fifty five is related to five volts
00:04:00
and the one in the middle which
00:04:03
would be a one hundred and twenty
00:04:04
eight that is related to two and
00:04:07
a half volts so you see that
00:04:09
there's a proportional relationship between the integral
00:04:11
number and the voltage
00:04:14
so it's the same idea as the
00:04:17
first one although the range is just
00:04:19
four times shorter
00:04:21
so how will we program it well
00:04:23
the first thing we need to do
00:04:26
is create a variable in this case
00:04:27
our variable is called input and we
00:04:29
read the analog input with this block
00:04:33
the one that's connected to a zero
00:04:35
and we store it in the variable
00:04:38
called input
00:04:39
and then we're going to divide this
00:04:42
variable by four because the range we're
00:04:43
using for this output is four times
00:04:46
shorter than the range where using to
00:04:48
read the values and we use this
00:04:50
range to send this value to eleven
00:04:53
so it will send the value to
00:04:58
the LED and the LED shines according
00:05:00
to the value that we're sending
00:05:04
so on zero it doesn't shine here
00:05:09
in the middle it shines a little
00:05:11
bit and if we move it all
00:05:13
the way
00:05:15
it's the brightest okay so this is
00:05:17
the circuit this is the first thing
00:05:20
you have to do just create the
00:05:21
circuit but this is just the first
00:05:23
step your exercise is going to be
00:05:25
a little different
00:05:28
your exercise is here it's rgb we're
00:05:30
going to use a new component that
00:05:34
is called the rgb LED and you
00:05:36
can find it down here in the
00:05:40
components library
00:05:41
so it's an LED with four
00:05:44
pins four connectors the first one is
00:05:46
called a red connector one of them
00:05:48
is called the blue connector and one
00:05:51
of them is the green connector and
00:05:53
this one here is just the cathode
00:05:56
and it's connected to the ground through
00:05:58
the protection resistor that we always have
00:05:59
at two hundred and twenty
00:06:02
don't forget that
00:06:03
so it means that this LED will
00:06:06
combine three colors so we will read
00:06:08
three different values using a zero a
00:06:11
one and a two
00:06:15
okay can you see that we have
00:06:19
three voltage dividers connected the way we
00:06:20
connected just one before we will use
00:06:22
these three variables instead of having input
00:06:25
we will have input one input to
00:06:28
input three for example
00:06:31
so we will be reading three values
00:06:36
the same way that we have read
00:06:39
them before and we will send three
00:06:41
different analog outputs the same way we
00:06:43
sent them before one for the red
00:06:45
one for the blue and one for
00:06:48
the green
00:06:50
so let's look at the simulation to
00:06:51
understand it better if i move this
00:06:54
first one the red control it means
00:06:56
I'm sending five volts through the red
00:06:58
wires
00:07:00
and you can see the LED is
00:07:03
red if i use the second one
00:07:04
to the maximum value now I'm sending
00:07:07
five volts to the blue wire
00:07:09
and it's the same with the last
00:07:13
one now I am going to send
00:07:14
five volts through the green wire
00:07:16
so the important thing is that we
00:07:21
can combine for example green and blue
00:07:22
and we'll get a new color it's
00:07:26
almost turquoise
00:07:27
what happens if we combine blue and
00:07:30
red
00:07:32
well you know we'll have purple
00:07:35
so the idea is that every color
00:07:38
can be produced using some combination of
00:07:40
red green and blue and I'm not
00:07:42
going to show you the code but
00:07:45
it will be something that's repeated three
00:07:46
times like the goal of the previous
00:07:49
exercise so you have to use a
00:07:51
variable read a number from the connectors
00:07:53
a zero a one and a
00:07:56
a two and storing the number in
00:07:58
the variable then dividing the variable by
00:08:00
four and sending it to the output
00:08:03
we want eleven ten and nine if
00:08:05
you know the connections for this one
00:08:09
and the exercise should be pretty simple
00:08:11
so try controlling the rgb LED using
00:08:13
three voltage dividers
00:08:16
good luck
00:08:19
- Idioma/s:
- Autor/es:
- David Gonzalez Arroyo, Alyssa Fantel
- Subido por:
- David G.
- Licencia:
- Reconocimiento - No comercial - Compartir igual
- Visualizaciones:
- 123
- Fecha:
- 21 de febrero de 2022 - 22:14
- Visibilidad:
- Público
- Centro:
- IES MARIE CURIE Loeches
- Duración:
- 08′ 20″
- Relación de aspecto:
- 1.78:1
- Resolución:
- 1280x720 píxeles
- Tamaño:
- 55.40 MBytes