Go Down

Topic: How i can save value from keypad in the variable value "x" ?? (Read 129 times) previous topic - next topic

AnasMaali

I have project"thermostat" and i don't Konw How i can save value from keypad in the variable value "x" (int x;)

the value Consisting of double-digit ??

LarryD

Please, you must show us your work. Attach your code using the </> icon on the left side of the posting menu.
Put your sketch between the code tags [code]Paste your sketch here[/code]
What keypad are you using?
What will this be used for?

Have you looked at tutorials on 'Arduino keypad'  ?
Here


.
No technical PMs.
The last thing you did is where you should start looking.

Graynomad

I do it like this

Code: [Select]
x = thermostatGetValue();

although YMMV, we wouldn't know because you have not provided any code or data on the device you are using.
Rob Gray aka the GRAYnomad www.robgray.com

sterretje

Store the two digits in a 3 character array; the last character must be '\0'. Next you  e.g.can use atoi() to convert to an integer.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Gabriel_swe

I have project"thermostat" and i don't Konw How i can save value from keypad in the variable value "x" (int x;)

the value Consisting of double-digit ??

Int(egers) goes from about -32000 to +32000, so your double digit value fits nicely.

x=keypad.getKey();

Maybe your problem is that you get a char (ascii value) from your keypad? That is 30-39 if hex value, or 48-57 if you get decimal value.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy