Need help with Serial comms to/from Arduino

edited October 2015 in Library Questions

I'm looking to send some integers from Processing to Arduino. One set will be 0 to 359, the other numbers will be a max of of 10,000. Once working the Arduino doesn't need to respond, but for testing wold like to get a confirmation that what I'm sending is getting there.

I have a Serial Object 'motorctl' which will send the numbers to Arduino. I use:


Then I wait for the reply from Arduio:

if(motorctl.avaiable > 0) { motorCtlMsg = motorctl.readStringUntil('\n); }

I'm not sure if the readStringUntil... is the right option to use - and in the reference I haven't found an example explicitly for sending numbers. It would seem with the above I'd have to convert that String to an int. So far all I get is 0, no matter what I send from Ard.

On the Arduino side, I'm using: if (Serial.available()) { string Msg = Serial.readStringUntil('\n'); } and when something is received i send a reply via println statement which shows in the processing consol. Currently I'm sending a number: Serial.println(250); - but processing gets a 0. In all cases.

I've got the link set up ok - just need some help with the correct usage of the Serial functions.


Sign In or Register to comment.