Menu

Topic-icon Sending Array

More
4 months 1 day ago #29534604 by John145
Sending Array was created by John145
I have connected roboteq and arduino on rs 232. And I need to transfer an array of data to arduino (slave). I have already transferred the data from master (roboteq) to the slave, but not using arrays, this method works for me. But it does not suit me.
I do not know what the problem is. Either in the script or in the sketch.

Here is my script:
DIM arr[10] as integer


top:

	BatteryVolts = getvalue(_VOLTS, 2)
	arr[0] = BatteryVolts

	Temp = getvalue(_TEMP, 1)

	arr[1] = Temp

	print(arr[0],"\r")

	wait(250)
goto top

Here is my sketch (arduino):
int mystr[2]; 

void setup() {
  Serial.begin(9600);
  Serial1.begin(115200); //for arduino mega
}

void loop() {
  if (Serial1.available() >=0) { 
    Serial1.readBytes((byte *)mystr,sizeof(mystr)); 
    
    int value0 = mystr[0];
      Serial.print(value0); 
        Serial.println("     ");
  }
  else {
    Serial.println("Tx Rx failed!");         
  }
  delay(1000);
}

Please help with explanations, because I am a teenager, so I do not have much experience and knowledge. Thank you in advance)

John

Please Log in or Create an account to join the conversation.

More
4 months 1 day ago #29534605 by Gabriel_Isko
Replied by Gabriel_Isko on topic Sending Array
It's somewhat unclear what you are trying to do. Are you trying to debug the battery voltage and the temperature?

It is also unclear what it is not suitable for your purposes, if it is working. Perhaps you could explain a little bit more about why you don't like implementing this debugging this way, or why it isn't working for you?

Please Log in or Create an account to join the conversation.

More
4 months 1 day ago #29534606 by John145
Replied by John145 on topic Sending Array
I want to transfer data from roboteq (temp, volts, etc.) using an array, and read it on the arduin and display it on the screen (so far, only in Com port).
As for why I want to transfer data in an array, I just think that it is much more convenient than other options. But, while I do not know how to write it and whether it is possible to write it at all.

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #29534619 by John145
Replied by John145 on topic Sending Array
No one has any thoughts on this topic?

Please Log in or Create an account to join the conversation.

Time to create page: 0.084 seconds
Go to top