VMM501
V. 01 – 17/01/2019
17
©Velleman nv
Have a look at the code below.
1.
Drag and drop the code blocks to form the code as shown.
You can find the
set item to
block in
Variables
in the Code Drawer. You
can find the
map/from low/from high/to low/to high
and
analog
read pin
blocks in
Pins
in the Code Drawer. You can find the
mathematical function minus
and
divide
in
Math
in the Code Drawer.
You can find the
show number
block in
Basic
in the Code Drawer.
2.
First, we make two variables. Go to
Variables
in the Code Drawer and click
on
Make a Variable
.
Enter
vol
in the window and click
Ok
. Enter
tem
in the window and click
Ok
.
You will see two new variables under
Variables
in the Code Drawer.
We will need these variables later to save the data in a register.
Drag and drop the
set item to
block in the
forever
block and select the
vol
option via the arrow.
Next, we drag and drop the
map/from low/from high/to low/to high
block over the 0 next to the
set item to
block.