Putting a char into a int

Hello, I need help in figuring my dilemma here

See right now I have this, it will normally prints out an A and B alternatively

 char letter=(char)data[0] ;
 Serial.print(letter);

//prints out A or B

What I’m trying to do is put letter into define variable called moisture. Basically something like this

 int moisture=0;

So something like this… where the A is from letter

moistureA= random value;

Can something like this be done? Thanks a lot

Can you give us more detail on how you intend to use all of this, because I’m thinking there must be a different easier way. Are you trying to use Spark.function()'s and Strings or what exactly are you doing with this moisture variable?

1 Like