Loading...
Pages: [1]   Go Down
Author Topic: data type mismatch?  (Read 145 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I'm wondering if I have a data type mismatch in my code below:

In this piece of code, Module has been previously declared as a const int, and RxMod has been declared as a int.  RxMod is coming in on a serial line as an element in a String array, and it is parsed out into a value.  I think that value is actually the ASCII value for the value the RxMod int should be.  I tried typecasting it to make the if statement work, but I never seem to be able to branch into the Subroutine() function.

Code:
if (char(RxMod) == Module) { 
    Subroutine();
  }
Logged

Global Moderator
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 218
Posts: 13896
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't really understand your question, but I can tell you what it won't do.

Your code won't convert an ASCII value (like 0x39 for '9') into a decimal value (like 0x09 for 9).
Logged


Pages: [1]   Go Up
Print
 
Jump to: