You just need to think a little bit to help me find the solution

Maurício Vilarinho

I have rpm, max_rpm and a variable x.

When rpm aproaches max_rpm -> x tends to 0

When rpm aproaches 0 -> x tends to 255

x = (rpm/rpm_max)*255;
arduino.analogWrite(g,(int)x);

I have the exact opposite. What can I do? I'm really dumb to figure it out.

obe

If I understood your question correctly then maybe this?

x = (1 - rpm/rpm_max)*255

UPDATE: as mentioned by CandiedOrange - rpm and rpm_max need to be float or double for it to work. Otherwise the value of x would simply switch back and forth between 0 and 255.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Just need a little help debugging my code

Need a little bit of help finishing a generic MySQL select method

need help to find a php structure solution

I need help to find solution for this query in MySQL?

Can you help me install clang-14 on Ubuntu 18.04? I think I need a valid repo as apt-get install clang-14 does not work :(

Can you help me to find the error?

Need help to find a bit wise operation to fit my case study

Need little help php mysql

Need a little regex help in python

need a little help finishing this code

Need a little help populating in Excel

Need little help on React hooks

Need to learn some javascript codes!! Would you help me?

SQL Help - Think I need a subquery

Can you Help me correct this simple c program's little mistake?

Little bit of help needed here with php

Can you help me find the bug in the CUDA Kernel?

Could you help me find a way how to loop through an array?

Can you help me to find a regex for a specifc String?

Just need a little guidance on functions in swift 3

Need a little help, in hiding/disabling the jbutton

Need a little help to fix an Arduino RFID program

I need some help for a little SwiftUI animation

I just started learning SQL and I couldn't do the query, can you help me?

Somebody could help me with this little program in prolog?

I Think I Just Messed Up My Whole System, HELP!

I have to find a missing number from a list just using for loop, see the code once i think you will understand

Need help understanding the solution for the Jewelry Topcoder solution

Need help printing just 1 decimal place