I'm pretty new to all of this programming lark so please pardon my ignorance, but I've been working on a remote sensor I was hoping to have sending its values to another Arduino board I have hooked up to a computer for monitoring. Trouble is that messing aroung with the demostration code I couldn't get past the "const char" nature of the data it sends in strings, suggesting that I can have multiple "const chars" but not a normal manipulatable "char" I can send as a string
Does anyone know a fool proof (it must be FOOL proof) way to code such a variable that I could explain to my grand mother. Not that she needs to know, but if she could understand it, maybe I could too.
Been a while, eh? sorry for not replying. I got caught in a storm of woe regarding my other work and completely forgot I sent it. Figured it out eventually on my own, but I'd still say I'm an Arduino noob. So thanks again.
I will let you further in on another problem I'm having: I'm trying to find a way to get a bunch of tokened values into an array that I can 'select from' by 'pointing' at their array number, if that's the right terminology. Here's the code so far:
void setup(){
Serial.begin (2400);
Serial.println ("Setup");
}
int R;
int G;
int B;
int index;
int i;
char msg[] = "RGB,23,34,54,7e,2f,c8"; //I want the last 3 entries
char Ray[7];
char* prt = strtok (msg,",");
void loop(){
while (prt!= NULL)
{
i = sscanf(prt,"%x",&index); //converts the characters to HEX values
Serial.println(index);
prt = strtok(NULL,",");
}
delay (500);
}
And I'm happy to report an output of:
Setup
0
35
52
84
126
47
200
But I have no idea how I can get these into an array so I can call them as "R = index[4];G = index[5];B = index[6];]
The underlying idea is to convert a string of DMX byte values into this list, but I think I have to sort out this issue once and for all. Can anyone help. It'll be even more appreciated this time