OK .. So Math Was is NOT my best subject
-
Geee. I have to ask such a simple question but I AM SURE you folks are ALOT smarter than me! Especially at math! (But I work with with my hands like a Master!) Anyway, seemed so simple untill I tried to do it.. LOL.. Lets say you have a Joystick that inputs 0 to 1000 units. I want to limit the output to some variable (To keep it simple I'll use whole numbers) to some variable such as 40, 50, 60 etc. that gives a output that is from 0 to this variable in equal units? I'm so STUPID at Math! Sorry my Left or Right brain not working for this simple problem!
-
Geee. I have to ask such a simple question but I AM SURE you folks are ALOT smarter than me! Especially at math! (But I work with with my hands like a Master!) Anyway, seemed so simple untill I tried to do it.. LOL.. Lets say you have a Joystick that inputs 0 to 1000 units. I want to limit the output to some variable (To keep it simple I'll use whole numbers) to some variable such as 40, 50, 60 etc. that gives a output that is from 0 to this variable in equal units? I'm so STUPID at Math! Sorry my Left or Right brain not working for this simple problem!
divide the actual output by 1000, then multiply by your variable to get the new scaled output. onew = (oold /1000) * var
-
divide the actual output by 1000, then multiply by your variable to get the new scaled output. onew = (oold /1000) * var
SO SORRY I voted a 1 when I should have Voted a 5! I told you I was STUPID! At first glance my brain said 1 was THE BEST.. Thank You.. DO not be to harsh on me.. I'm really a nice old man..
-
Geee. I have to ask such a simple question but I AM SURE you folks are ALOT smarter than me! Especially at math! (But I work with with my hands like a Master!) Anyway, seemed so simple untill I tried to do it.. LOL.. Lets say you have a Joystick that inputs 0 to 1000 units. I want to limit the output to some variable (To keep it simple I'll use whole numbers) to some variable such as 40, 50, 60 etc. that gives a output that is from 0 to this variable in equal units? I'm so STUPID at Math! Sorry my Left or Right brain not working for this simple problem!
i think solution is in following steps 1.get the maximum value of the out put.say you get that for input 1000. it means you would want to get myMaxLimit when you get maxOP 2.so now you can use follwoing formula to limit your input desiredOP = (currentOP/maxOP)*myMaxLimit sameer
-
SO SORRY I voted a 1 when I should have Voted a 5! I told you I was STUPID! At first glance my brain said 1 was THE BEST.. Thank You.. DO not be to harsh on me.. I'm really a nice old man..
And if your joystick is connected to an embedded system with no hardware floating point support, you can keep everything in integer with good results by reordering the arithmetic: onew = (oold * var) / 1000 You might have to cast the old variable to the next larger type to be sure you don't overflow and then cast back.
The evolution of the human genome is too important to be left to chance.
-
Geee. I have to ask such a simple question but I AM SURE you folks are ALOT smarter than me! Especially at math! (But I work with with my hands like a Master!) Anyway, seemed so simple untill I tried to do it.. LOL.. Lets say you have a Joystick that inputs 0 to 1000 units. I want to limit the output to some variable (To keep it simple I'll use whole numbers) to some variable such as 40, 50, 60 etc. that gives a output that is from 0 to this variable in equal units? I'm so STUPID at Math! Sorry my Left or Right brain not working for this simple problem!
I would like to add, to the other comments psted here, that you can also do integer rounding. For example: (1456+500)/1000=1 (1677+500)/1000=2 As you can see 1456 gets rounded to 1 and 1677 gets rounded to 2. It is just like rounding floating point numbers 1.456 and 1.677. In fact, all values from 500 to 1499 will be rounded to 1, and all values from 1500 to 2499 will be rounded to 2. Rogério Rilhas
-
I would like to add, to the other comments psted here, that you can also do integer rounding. For example: (1456+500)/1000=1 (1677+500)/1000=2 As you can see 1456 gets rounded to 1 and 1677 gets rounded to 2. It is just like rounding floating point numbers 1.456 and 1.677. In fact, all values from 500 to 1499 will be rounded to 1, and all values from 1500 to 2499 will be rounded to 2. Rogério Rilhas
thanks: https://movied.org
-
divide the actual output by 1000, then multiply by your variable to get the new scaled output. onew = (oold /1000) * var
thanks: https://movied.org
-
SO SORRY I voted a 1 when I should have Voted a 5! I told you I was STUPID! At first glance my brain said 1 was THE BEST.. Thank You.. DO not be to harsh on me.. I'm really a nice old man..
thanks: https://movied.org
-
i think solution is in following steps 1.get the maximum value of the out put.say you get that for input 1000. it means you would want to get myMaxLimit when you get maxOP 2.so now you can use follwoing formula to limit your input desiredOP = (currentOP/maxOP)*myMaxLimit sameer
thanks: https://movied.org
-
And if your joystick is connected to an embedded system with no hardware floating point support, you can keep everything in integer with good results by reordering the arithmetic: onew = (oold * var) / 1000 You might have to cast the old variable to the next larger type to be sure you don't overflow and then cast back.
The evolution of the human genome is too important to be left to chance.
thanks: https://movied.org
-
Geee. I have to ask such a simple question but I AM SURE you folks are ALOT smarter than me! Especially at math! (But I work with with my hands like a Master!) Anyway, seemed so simple untill I tried to do it.. LOL.. Lets say you have a Joystick that inputs 0 to 1000 units. I want to limit the output to some variable (To keep it simple I'll use whole numbers) to some variable such as 40, 50, 60 etc. that gives a output that is from 0 to this variable in equal units? I'm so STUPID at Math! Sorry my Left or Right brain not working for this simple problem!
thanks: https://movied.org