# Double Digits with IR remote

I have looked on the net for code or at least something similar, but all i found was people discussing the theory behind it. Can anyone point me to a resource or make a rough version? I’m new to Arduino so anything would help.
Overall I’m looking to be able to be able to use double digits so that I can make more cases for my remote controlled car. And the remote is basic. Up,down,left,right. 1,2,3,4,5,6,7,8,9,0 and #, * are the buttons I can work with.

So I’m putting the code as a downloadable file because this post exceeds maximum allowed length.

FinalProject7.ino (8.54 KB)

If you have code that works with your single digit keypad, please show it. That is the code to begin to modify, not something entirely from scratch.

Paul

Use the same code that you use to get one digit. Then multiply that by ten and use that code again to get another digit. Add that to the first one that you multiplied by ten and you got a two digit number. Multiply that by ten and add another digit and you get three digits.

Delta_G:
Use the same code that you use to get one digit. Then multiply that by ten and use that code again to get another digit. Add that to the first one that you multiplied by ten and you got a two digit number. Multiply that by ten and add another digit and you get three digits.

That, and be careful not to fall into the trap of confusing a digit character with the numeric value represented by that digit.

`'1'` does not equal `1`

Delta_G:
Use the same code that you use to get one digit. Then multiply that by ten and use that code again to get another digit. Add that to the first one that you multiplied by ten and you got a two digit number. Multiply that by ten and add another digit and you get three digits.

I understand what you are saying, only problem is that I am new to Arduino, so could you perhaps make a rough sketch of this? Also, would this work with single digit inputs or would I need to make a enter button?

Also, would this work with single digit inputs or would I need to make a enter button?

How will the Arduino know that you want to enter just a single digit number?

Do you really need help multiplying a variable by 10?
Do you really need help adding a value to a variable?

``````int theNumberBeingEntered = 0;

void loop()
{
int theDigit = GetDigit();
if(theDigit >= 0 && theDigit <= 9)
{
theNumberBeingEntered *= 10;
theNumberBeingEntered += theDigit;
}
else
{
// A non-digit was entered, meaning use the value and reset for the next time
Use();
theNumberBeingEntered = 0;
}
}
``````

Thank you for showing me how.
But I ran into a logic problem trying to turn the signal data(the program turns it into numbers ex: 16736925) into a one digit number.
So basically I'm trying to tie 16736925, which is #1 on the remote to 1. 16754775 to #2 on the remote and so on.
The problem I run into is the error:
"expected unqualified-id before numeric constant"

I got it trying to do this

const int 1 = 16736925;

so I than tried to assign the 16736925 to char "a", and char "a" to 1.
I did this by

char myChar1 = "a" ;
char myChar1 = 1;
#define a 16736925

but as you can see I didn't think it through and it failed. Miserably.
So I'm wondering if there is any way around the
"expected unqualified-id before numeric constant"?

"expected unqualified-id before numeric constant"

I got it trying to do this

const int 1 = 16736925;

Page 3 of any C/C++ book talks about valid names for variables. The first (or only) letter in a variable name can NOT be a number.

Page 5 talks about the valid range of values that a variable of a given type can hold. 16736925 is NOT a value that can fit in an int.