Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:52 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Last question - variable range MMBASIC

Author Message
robarino
Newbie

Joined: 15/03/2012
Location: Sweden
Posts: 24
Posted: 01:26pm 15 Mar 2012
Copy link to clipboard 
Print this post

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: Australia
Posts: 5078
Posted: 01:32pm 15 Mar 2012
Copy link to clipboard 
Print this post

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: Sweden
Posts: 24
Posted: 01:38pm 15 Mar 2012
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 3800
Posted: 05:43pm 15 Mar 2012
Copy link to clipboard 
Print this post

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: Australia
Posts: 82
Posted: 11:25pm 15 Mar 2012
Copy link to clipboard 
Print this post

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: Sweden
Posts: 24
Posted: 08:35am 17 Mar 2012
Copy link to clipboard 
Print this post

@Vikingboy!

Exactly! It is incredibly useful!

 
djuqa

Guru

Joined: 23/11/2011
Location: Australia
Posts: 447
Posted: 08:38am 17 Mar 2012
Copy link to clipboard 
Print this post

Just create a Defined subroutine that accepts the input value and returns the desired value.

VK4MU MicroController Units

 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024