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?
0 -
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
0 -
Perfect... exactly what I was trying to do...thanks
1
Howdy, Stranger!
Categories
- 118 All Categories
- 3 Community
- 3 Hello Maker!
- 103 PicoBricks - Make, Run, Split, Merge
- 1 PicoBricks IDE
- 1 Arduino IDE
- 32 Hardware Support
- 15 PicoBricks Backers Hub
- 49 MicroBlocks Support
- 3 Shipping Support
- 2 MicroPython
- REX - 8 in 1
- Mechanical Parts and Parkour
- REX Main
- Arduino-IDE
- REX - Shipping
- 12 Products & Technology
- 2 Raspberry Pi
- Arduino
- 10 Other