Analog pin is behind multiplexer. #22
-
I have just a single analog pin, and I have connected to a multiuplexer to get more analog pins. Is there any way to just pass the value instead of sense pin? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I have added following functions in the cpp/h to create battery class without sense pin |
Beta Was this translation helpful? Give feedback.
-
If all you want is to map a sensed voltage to a battery percentage then you don't need to instantiate the
You only have to convert the value you sensed to a voltage and those functions have been declared static also to support this use case. What suggested by @Mingyu-Kim only wastes additional memory to store data that you are not going to use, so the memory is wasted without any benefit whatsoever. |
Beta Was this translation helpful? Give feedback.
If all you want is to map a sensed voltage to a battery percentage then you don't need to instantiate the
Battery
class: just use any of the static functions provided:You only have to convert the value you sensed to a voltage and those functions have been declared static also to support this use case. What suggested by @Mingyu-Kim only wastes additional memory to store data that you are not going to use, so the memory is wasted without any benefit whatsoever.