Introduction to LEGO Mindstorms EV3

Outputs

Your browser needs to be JavaScript capable to view this video

Try reloading this page, or reviewing your browser settings

Change your robot’s display and have it make sounds.

Keywords

  • outputs
  • sound
  • notes
  • piano
  • display
  • lights

About this video

Author(s)
Kevin Briggs
First online
03 July 2019
DOI
https://doi.org/10.1007/978-1-4842-5179-9_6
Online ISBN
978-1-4842-5179-9
Publisher
Apress
Copyright information
© Kevin Briggs 2019

Video Transcript

In this video we’re going to learn all about the other outputs that we have in this green tab that are not necessarily the motors.

So we have our display, our sound, and our brick status sites. We will learn to use all three of those. So I’m gonna make a new program. And I’ll just call it Outputs.

And first one I’m going to use is this sound one. So I’m going to drag it up here. And if I press Play–

Hello.

Hello. It says hello. That’s nice.

I can go here, and I can get different sound files. And I can get any kind of sound that I want. So if I have boo–

Boo!

It will–

[BOING] [CHEERING]

So I go here. Now if I press Play–

[CHEERING]

Now let me go into here. And I’m gonna go to Play Tone. Play Tone will pick a tone that you can choose. And you can see here it gives you the corresponding note.

So this is one option that you have for playing different notes. This gives you very finely grained control. So I can do 440 or 441 and get really exactly what I want.

The one that I prefer, though, is to go to Play Note. And Play Note if you click on it, it allows you to pick any kind of note that you want so that you can play different songs. So let’s start off with a C. Go like that. When I press Play–

[MUSICAL TONE]

It plays note C for one second at 100 volume. I can change this and do 0.52 seconds. And let’s bring it down a little bit. I don’t want to annoy all the people in the room.

[MUSICAL TONE]

And it’s much shorter. Now here we have different options. We have a Wait for Completion. This will wait for the note to complete until this next block goes. This one does play once. And this one just repeats.

So let’s see what happens if I do Play Once. I’m gonna click here.

Nothing happens. There’s almost like a little popping sound. And the reason for that is that it goes beyond here, and then the program just stops. So it never has time to do this note.

What we can do is we can go into this yellow tab. If you bring out this wait, this will wait for one second before the programming ends. And we will go into these blocks in much greater detail in later lectures. But for now, just use this wait. Know that it waits one second or however long you want. If you do like three seconds, it will wait three seconds.

Now I’m gonna do it.

[MUSICAL TONE]

Does that. And then it waits three seconds. So I have that. And now what I can do is I can– I’m going to get rid of this. I’m going to go into here. And I’m going to get my Brick Status light.

For my Brick Status light it changes the light. If you look here, you can see it’s green right now. But if I change it, now do red. And I can click it.

You can see it changes to red. And it blinks.

So let’s say I don’t want it to blink. I can click on False, and now when I do it– it’s just a steady color like that. And you can pick any kind of color you want– green, yellow, or red.

And like a useful case for this– maybe if you are trying some programming and you want to see if it works, if you have a successful case, you could have it go green or yellow. If it goes wrong, then you can go red. And it’s sort of an easy way of spotting that when it’s on the table or in some kind of challenge, and you don’t need to hear anything. You can just see that it’s whatever color it is.

Let’s go to the final output that we have. And it’s Display. So here we have a couple different options. First I’m going to go into the shapes and take either pixels or grid.

And right up here you see it says Mindstorms. If I click on it, you can see it says Mindstorms right up top.

If I go down, if I increase the y value, watch what happens to it.

You can see you can’t see it anymore, because the y value has increased. And– or sorry– it has decreased. And this measures it from the upper left hand corner.

So this is 0,0. This is like 100,0. This would be 100,100.

So let’s try If we do 100 and 100. Let’s see where this goes.

You can see it goes all the way down there. So I was a little bit off with my estimation. But you can play around with this and sort of get it wherever you want.

You can change the font size right here. The color will give it– if you switch this, it will give it kind of a shadow.

I’m going to go into shapes. Let’s try to get a circle. In circle you have the diameter of the circle and if you want to fill or not.

So this will add x100 and y100, it will create a circle that is 40 diameter. So let’s go there. And see, it’s all the way down there.

But I want a fill for that. So I’m going to change that. And then I want it to be a little bit up. I’m going to go 20 and 20. See it changes.

You can see now it’s up there. And you kind of play around and get whatever you want. If you do like a rectangle, then you could– this is the width and height of it. And the same sort of parameters that you had before with xy and all that.

But the real fun thing about this is using the image. Just like before, we could pick our file out. And if you go here, they have a ton of different things.

So if you do eyes– let’s do Angry. And now when I click that, you see? I still have the x and y changes. So I don’t want that for that. I want to keep that at 0.

Try that again. And see there it is right in the middle. And the cool thing is that we can kind of like animate this stuff.

So if I bring out another one, whoops. There we go. Eye– so let’s do– let’s do Disappointed as well.

So it’ll switch back and forth between these two. So I’m gonna go like this. And we will have a better way of doing this later. But for now I’m going to bring this out. Now when I do it– you can see he’s going back and forth with his mood.

And not only can we do the display like that, we could also do some notes. So we can make a little song.

So I am going to bring this out here. And I am going to do Play Note. I actually don’t need these.

So I’m going to have it wait until it’s completed. So let’s do 0.25. And let’s have it play the note, switch the note, see if it can play a little song here. Copy a couple of these.

Put them all next to each other. OK. And now let’s go here. Done. Go that way. Down here.

Go.

And if I play it, it should–

[MUSICAL NOTES]

Had the start of Mary Had a Little Lamb. And you can go a lot crazier with that. But that’s just some kind of examples of the various outputs that you have here. They could be a lot of fun to play with, but they could also be very useful if you are trying to test things out and see where your programs are going wrong.

So we experimented a little with the wait block And our next video we are going to go more into depth and with the loop and the wait blocks, and then see how we could use those in order to better control our robot.