Cannot scale pot value

See this code.

It's returning 0 for scaled. Guessing it sees the pot value as a string vs an integer. any way to convert it to an integer. What am i missing here?


And I realize this does not correctly scale the value. Just trying to get any math out of it. Have tried a lot of different ways to tackle this.


Comments

  • No, you get a number back. MicroBlocks uses only whole integers. So if the number is less then 1023 it will always be 0 because everything else will be behind the comma. if it is bigger or equal to 1023 it will be 1. You have to wait until 2046 for it to be 2.

    What result are you expecting to show?

  • PeterMathijssen
    edited March 5

    If you set the advanced blocks option in the menu


    you get a rescale block


    that you can use to rescale potentiometer for instance. It is a very powerful block.


    Here is a topic with an example

    https://community.robotistan.com/index.php?p=/discussion/72/potentiometerbar

  • Perfect... exactly what I was trying to do...thanks

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!