I need little help regarding arduino programming.
I have arduino program. what I need is to change spd values in arduino code from LabVIEW over serial communication. I tried to it but its not working for me right now. Any idea..
I have attached my arduino code and labview program. please assist
When you say
its not working
what exactly do you mean ?
You have declared 2 different variables named spd, each with its own scope which may be causing a problem
Please follow the advice on posting code given in Read this before posting a programming question in order to make your sketch easy to read, copy and test
In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless
If the code exceeds the 9000 character inline limit then attach it to a post
This non-blocking code to read/parse integers from Serial may help ReadToInt_String.ino
Also see my Arduino Software Solutions for other solutions to reading text from serial.
A more reliable way to read input is in this tutorial: Serial Input Basics - updated
A more reliable way to read input...
Meh. Both versions have an issue. I'd call it a coin flip.
Unfortunately serial basics uses atoi to convert text to int which is NOT very reliable
I assume the serial basics claim for reliability is the use of start and end markers
Arduino Software Solutions has that as one of the possible solutions
Serial basics also handles buffer overflow by truncating the input.
Arduino Software Solutions provides a number of alternatives that don't return a bad partial result in that case.
Possibly not related to your current problem but variables that are used in both the ISR and in the rest of the program should be declared volatile.
I was comparing the OPs current implementation to Serial basics, not to @drmpf's library. Sorry, should have been more clear.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.