![]() |
Forum Index : Microcontroller and PC projects : Last question - variable range MMBASIC
Author | Message | ||||
robarino Newbie ![]() Joined: 15/03/2012 Location: SwedenPosts: 24 |
I was wondering if there is some sort of scale command where you can set the range of a variable. For instance voltage range 1 to 5.0000 to the range 1 to 300? I have looked at the manual and cannot seem to find it. |
||||
Gizmo![]() Admin Group ![]() Joined: 05/06/2004 Location: AustraliaPosts: 5112 |
Hi robarino Do you mean a multiplier? If variable A ranges from 1 to 5, then A*60 ranges from 1 to 300. Also remember the Maximite can only measure up to 3.3 volts, its supply voltage. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
robarino Newbie ![]() Joined: 15/03/2012 Location: SwedenPosts: 24 |
Hej Glenn, Thanks for replying! I know you can multiply but in Arduino for example you can set the range before and it takes care of it for you. I forget the command but it is useful. |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4020 |
I wonder if the Arduino does it because it's a quite slow system. The MM & DM are so much faster that a few multiplies etc don't normally matter. John |
||||
Vikingboy Regular Member ![]() Joined: 23/09/2011 Location: AustraliaPosts: 82 |
Hi, I think the command at least on other basic systems is called "Map", I only know because when I first started using the maximite I read a few online BASIC guides and I saw it in one and thought it would be really handy, still do ;) AFAIK it maps an input range to an output range linearly, would be handy for handling analogue inputs easily. rgds, Andrew |
||||
robarino Newbie ![]() Joined: 15/03/2012 Location: SwedenPosts: 24 |
@Vikingboy! Exactly! It is incredibly useful! |
||||
djuqa![]() Guru ![]() Joined: 23/11/2011 Location: AustraliaPosts: 447 |
Just create a Defined subroutine that accepts the input value and returns the desired value. VK4MU MicroController Units |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |