I have a question regarding Arduino Serial Communication.
I have written a program in Visual Basic to control the Arduino Board and I am sending strings through the serial from Visual Basic. For example, I want to send "1;255". In this string, the number "1" is the pin number and the number "255" is the analog value that needs to be written to the pin. However, I am unable to write a program that takes everything to the left of the semicolon and declare it to be the pin number and take everything to the right of the semicolon and set it to be the analog value that needs to be written to the pin. Can somebody help me with the program. I am a new comer to Arduino Programming. So I will appreciate if somebody wrote me a complete program and tell me what each of the line in the code does!
However, I am unable to write a program that takes everything to the left of the semicolon and declare it to be the pin number and take everything to the right of the semicolon and set it to be the analog value that needs to be written to the pin. Can somebody help me with the program. I am a new comer to Arduino Programming.
That is a challange esp for newcomers to Arduino programming. The hardware serial and supporting software library are single character at a time interface. What you require is software that can assemble the characters sent from the PC, a character at a time, and then parse the required information from the sent string. There is no general purpose Arduino friendly string parsing library avalible that I'm aware of, so you are kind of on your own to build the needed functions.
If you can write a VB application, you have some programming skills.
Read the tutorials, work through the examples, experiment and modify a little, and ask us about your coding problems.
Requests for others to write complete sketches for you tend to fall on deaf ears.
Well, to give a little better help, below is some working code that shows how I parce info from a string using "WString.h". Its info can be found at the below link. I'm still working on collecting a string from te serial port using "WString.h".