Pages: [1]   Go Down
Author Topic: Assign problem  (Read 47 times)
1 Member and 1 Guest are viewing this topic.
Online Online
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How can I assign codes below to unsigned char data[8];
I couldnt assign codes below, Normally when I run the code, I can see 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 on serial port
but I must assign these characters to "data" Please help smiley-sad


for(int nIndex = 0; nIndex < nMsgLen; nIndex++)
  {
  Serial.print("0x");
  if(nMsgBuffer[nIndex] < 16) Serial.print("0");
  Serial.print(itoa(nMsgBuffer [nIndex], sString, 16));
  Serial.print(" ");
  }
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24370
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd probably use sprintf, but I'm not clear exactly what it is you're trying to do.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Online Online
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to assign result to variable which is coming from code below.

for(int nIndex = 0; nIndex < nMsgLen; nIndex++)
  {
  Serial.print("0x");
  if(nMsgBuffer[nIndex] < 16) Serial.print("0");
  Serial.print(itoa(nMsgBuffer [nIndex], sString, 16));
  Serial.print(" ");
  }

 
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46107
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I want to assign result to variable which is coming from code below.
There is no variable coming from that code.

That code is sending data to the serial port.

So, try again. What variable do you want to assign a value to? Where is that value to come from?
Logged

Online Online
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I want to assign result to variable which is coming from code below.
There is no variable coming from that code.

That code is sending data to the serial port.

So, try again. What variable do you want to assign a value to? Where is that value to come from?

Yes, but I dont want to send this data to serial port only.. I want send this data to serial port and assign this data to "MyData" variable. For example another part of this code I want to see this data in MyData variable if I call it again.
« Last Edit: Today at 03:47:33 pm by Aleyna » Logged

Pages: [1]   Go Up
Jump to: