Академический Документы
Профессиональный Документы
Культура Документы
Variables
You can take a motor power value and STORE it inside of a variable for later use.
Variables
Variable Types
Variable Types
Unlike integers, these numbers are allowed to have decimal values and
are referenced by float.
Variable Types
Variable Types
Variable Types
Variables can even be simply true or false which use Boolean logic and
referenced by bool.
When you name and integer type variable you cannot use:
Spaces
Characters(!)
Numbers(1)
Already reserved/recognized terms(int)
Test
The idea behind this is that you can now
change the motor powers in ONE place
instead of 12 places as you test. This is just
one way to program efficiently.
Functions
Functions are pieces of code
that come BEFORE task main.
We use void to begin our
functions. The function itself is
then given a name, in this case
moveStraight. There is a set of
empty parenthesis after the
name. Then the commands are
placed inside the functions curly
braces.
The call
Then, when you are ready to
use the code, you simply call
it from within task main.
2.
3.
4.