views:

135

answers:

2
+3  Q: 

Attach variables

Hey everyone,

I want to take two variables (in and in2) and put them together, for example:

in = 1;
in2 = 3;

pin = in.in2; // I want this to set pin to 13

The arduino IDE tells me that in is not a class, so what syntax would I use to accomplish this?

EDIT: I figured out a different way to do it, you can just take in. multiply it by 10 and then set pin to the sum of in plus in2

A: 

try this, i wrote it in c but you get the gist. turn the two items into strings then concatenate and parse it as an integer.

pin = int.Parse((string)in + (string)in2);

Russ Bradberry
+1  A: 
Ed Woodcock