I am also trying to connect two pc Arduino because I do not have outputs for connecting to the GLCD.

I need to send value from my nunchuck and temp sensor to another Arduino.I've used the code here on the forum but what I can not handle is negative numbers.

I have negative numbers that I have to use in my other Arduino.What I need is something like:x = 50 or x = -50 can be positive or negative numbersy = 50 or y = -50 can be positive or negative numbers andtemp = 25 or temp = -2

Desire is to send all this in a string such as for example*- 50 79 25, all numbers can be a digit or more and could be negative.or maybe something like this*x=value y=value temp=value

I've used the code here on the forum but what I can not handle is negative numbers.

There have been more that 170, 000 posts. We could not begin to guess which of those posts contain the code you are using.

Quote

I have negative numbers that I have to use in my other Arduino.

If you have negative numbers, you must not be using an unsigned type. That is not, then, the source of your problem.

Quote

Desire is to send all this in a string such as for example*- 50 79 25, all numbers can be a digit or more and could be negative.or maybe something like this*x=value y=value temp=value

Either format is almost trivially simple. Using Serial.print(), the value specified is output as a string.

May I respectfully suggest that you use a closing delimiter, too. Send something like:

<-50 79 25>

This makes it much easier to determine when all the data for a packet has been received, and allows some level of checking for completeness. For example, there are two spaces in the string, so if you read '<', a number, a space, a number, a space, a number, and '>', you could be reasonably certain that there was no data loss.

If you have trouble sending or receiving and parsing the data, post your code. We'll be happy to help you get it working.

Writing it all for you, though, is not something we really want to do.

The code I'm using is from this thread that is from RobWhat I'm doing right now is that I send my data from the Serial Monitor. I am writing myself in the serial monitor window and see what happens.I have not tried to send data from my other Arduino. First I want to be sure that it works to receive and then I'll try to send from the correct source (Arduino)

Here is the code I have used where I send 7 characters * 252525 and it works but if I send *- 5-5-5 that is three negative numbers it does not work. I will use more characters later, but must first solve the problem.

Serial.flush(); // clear the serial buffer before reading new data char timeString[7]; // create a string to hold the time value when it's read memset(timeString,'\0',7); // initialize that string to all NULL characters boolean timeStringValid = false; // declare and initialize a variable to track whether the string has all valid characters //Serial.print("GET"); byte inByte = '\0'; // declare and initialize a byte to read in serial data long startTime = millis();//makes the start time = to now int timeout = 1000; // timeout after one second while(millis() - startTime < timeout && inByte != '*') { inByte = Serial.read(); // read data and wait for an asterisk character }

if (inByte == '*') { // if we got the correct start character (instead of a timeout) timeStringValid = true; // declare and initialize a variable to track whether the string has all valid characters long startTime = millis();//makes the start time = to now int timeout = 1000; // timeout after one second while(millis() - startTime < timeout && Serial.available() < 6) { ; //wait for enough data to be available (14 characters of time string), while doing nothing else } for (int i=0; i < 6; i++) { timeString[i] = Serial.read(); // reach each time string character into a character array if(timeString[i] < '0' || timeString[i] > '9') { timeStringValid = false; // if any character is bad then the whole string is bad } }Serial.print("Results: "); Serial.println(timeString); }

if (timeStringValid == true) { char yearString[3]; // create a string to hold the year part of the string memset(yearString,'\0',3); // initialize that string to all NULL characters strncpy( yearString, timeString, 2); // copy the first four characters of timeString into the year string Serial.print("X: "); Serial.println(yearString);

char monthString[3]; // create a string to hold the month part of the string memset(monthString,'\0',3); // initialize that string to all NULL characters strncpy( monthString, timeString+2, 2); // skip four characters, then copy the next two of timeString into the month string Serial.print("Y: "); Serial.println(monthString);