Slider Compass App +/- functions?

When trying to duplicate the blocks for the slider compass app finding the right logic functions for + or / are not available, could some-one please say how do you make them to follow the attached block not available as shown in examples. Thank you

usually the subject of a thread should be a short text like "Can't find the + or - function" and the body of a post is there to describe your problem more in detail...

I'm not sure if I understand the question, what exactly are you looking for?
See also the documentation MIT App Inventor Math Blocks


Many thanks for your advice. i have managed to make the coding work correctly.

On the screen the compass numeric heading shows. Can this value be displayed in a text box?

Kind regards


unfortunately I do not know, what you are talking about
a screenshot of your screen and your blocks might help...


you can see in the screenshot the numeric heading of the compass.
i would like to capture this in a text bow to display more clearly to users.

thanks and kind regards

What about using a label?

Set Label1.Text to get global azimuth

See also App Inventor Code Snippets | Pura Vida Apps


Thank you this works well.

I have included the slider control but when the azimuth reaches -0 the compass goes haywire before settling down again but not always in the right direction. Is this a general fault or is something wrong with my phone.

i am also trying to get to show the azimuth numeric value in a textbox / label.
0 - 45 North
45 to 90 North East
90 to 135 East etc

i have tried several ideas using a procedure but with no result.

Would you be able to help?


You probably need code to bring your azimuth back into the expected range (0-359?) when it gets too big or too small.

After updating azimuth:

While azimuth < 0
Set azimuth to azimuth+ 360

While azimuth > 360
Set azimuth to azimuth - 360

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Here are my blocks.
None of the procedures work so any advise greatly received.

Procedures need names and arguments.

Here's code to turn azimuth into compass heading text, along with a test framework for the Companion's Do It feature:


All 3 blocks can be downloaded (right click) and dragged into the Blocks Editor, as long as they are not editted in any Paint program.

Also, see Chapter 21 of

This is the Do It of the test:

Thank you for the additional blocks which i have included and the compass is very stable.
I have added a label naming it as compass_label but no text is appearing.

Please excuse my asking but am I missing something in the coding?

very kind of you to help with this


You have not yet learned how to call a value function?

Run the azimuth through the converter I gave you on its way into your label.text

Read the chapter on procedures in the free online book.

P.S. Don't make me tell the chainsaw joke.


It looks like uou should tell me the chainsaw joke.
I have tried to call the procedure please

see block and screen shot showing result.
the compass points are all showing as one line so i know still not getting this right.
Any additional help would be very welcomed as great learning curve for me.

Kind regards


Use the compas_label method instead together with the local variable azimuth from the orientation sensor

The test_headings procedure was only a test procedure


Chainsaw Joke

A city dweller buys a house in the country and needs to cut down some trees on his property.
He asks the local hardware store for something to use for his trees, and they sell him a chainsaw. Two hours later, he returns to the store, all sweaty, torn, and bloodied. He throws the chainsaw down on the counter an complains it doesn't work.

The counterman inspects the chainsaw, verifying it's chain is seated and oiled, and that the gas supply is okay. The counterman then pulls the starter rope and the chainsaw roars to life.

The customer then jumps back, and exclaims "What's that noise?"


Read the entire chapter, all the way to the bottom.

compass_headings.aia (3.3 KB)

Many, many thanks to you and Taifun for helping with this coding.
It works beautifully.