How to get ACSelect value as string? #416
-
Hello, thanks for your great library. I can not get selected option as an String. I'm using this and then trying to print as curr.value, but it says invalid use of non-static member function
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@fruktiz32 Hello, Thank you for your interest in AutoConnect. Serial.println(curr.value()); |
Beta Was this translation helpful? Give feedback.
@fruktiz32 Hello, Thank you for your interest in AutoConnect.
ACSelect retains the provided values as choice strings by a slightly different implementation than other AutoConnectElements. It saves the choice strings as an array with
std::vector<String>
, so the sketch cannot directly access thevalue
member to get a determined string.Use the
value()
function to get the string selected in ACSelect. So change your code to: