Main content
Electrical engineering
Math block
Math blocks allow you to scale values (and much more!). Created by Brit Cruise.
Want to join the conversation?
- Is this NXT Mindstorms?(4 votes)
- What do you think when you first see a robot?(2 votes)
- What are they talking about?(1 vote)
- They are talking about how to use the math block.(3 votes)
- Can anyone help me? I don't get it. 😃(1 vote)
- There showing you how to use a math block.(1 vote)
- tis okay for anyone from 6th all the way to what youre in right now(1 vote)
- Is this a comment on someone else's question or comment? If so, it belongs there.(1 vote)
- how did you show the right thing(1 vote)
- i watched this video to do a certain question but this is way off topic to my topic. And wat is the point of adding a question and comment block if they are not going to use it to improve.(1 vote)
- How calm if the problem look like six to the Zero power the answer is one(1 vote)
- It shouldn't. If anything it should be zero. For the fact there is a zero power means there isn't a number there. It would be the same thing as zero multipled by a number. The answer will always come out to be zero.(1 vote)
- khan academy is the best(1 vote)
- Why doesn't this video load?(1 vote)
- probably because you didn't click the button that looked like Youtube's logo(1 vote)
Video transcript
When we wire blocks together, we
will often run into a problem, and it's a range mismatch. For example, if we had the light
intensity value being plugged into the pitch input
of the speaker, let's see what would happen. Our light intensity
value will send it a number between 0 and 100. However, the pitch input
varies from 0 to 1,000, because it is a
different measure. So these are all
the different tones. If we think of it
as a piano, this is the whole width of the piano. So if we'd plug
these in directly, we actually would only hit
10% of all the values here, and this means this
number would need to be scaled by some amount. And that is when we can use
our math block to help us. The math block is very simple. It takes two inputs,
A and B, which you can plug into just
like I've shown you, and it spits out an output. So what you could do is
multiply things together, or scale a number, or say, take
whatever A is and add 5 to it and spit that as your output. So in this case, I have a light
sensor and a sound sensor, and instead of
plugging them together, I'm going to drop a math
block in between them. And now provide the
light intensity value to A-- that's the first
input-- and I'm not going to give it another
input B because I just want to either add, multiply, or
do something to this number, A. And I'll take the result
of whatever operation we come up with and plug
it into tone frequency. So in the math block,
just to be clear, the operations are addition,
subtraction, multiplication, division, absolute
value, and square root, so you should select the correct
operation here and fill in B. So let's say we wanted
to divide it by 5. I would put 5 in the box for B.
So if I provided the number 50, it would be divided
by 5, which is 10, and 10 would spit
out the other end. So fix this so that
after the math block, the value ranges
from 0 to 1,000.