E electronik54 Member Licensed User Longtime User May 25, 2016 #1 hi guys.. i am new with arduino. i was wondering if it was possible to send commands to arduino over serial comm... for example if i type setDo 1 1 on hyperterminal connected to arduino it will set DO 1 pin to high.. all that i was able to do was read just a single character. i need is some help or some push in right direction.
hi guys.. i am new with arduino. i was wondering if it was possible to send commands to arduino over serial comm... for example if i type setDo 1 1 on hyperterminal connected to arduino it will set DO 1 pin to high.. all that i was able to do was read just a single character. i need is some help or some push in right direction.
Erel B4X founder Staff member Licensed User Longtime User May 25, 2016 #2 Are you using AsyncStreams to read the data? Upvote 0
Adie Member Licensed User Longtime User May 25, 2016 #3 hi E54 It is better to be specific. 1. Read the string in Arduino 2 or the return value in B4R Etc etc. Also sometimes 2 line code snip will give us even better idea of what and how you did it. OK I'll assume that you send the string setDo 1 1 with B4R to the arduino. the arduino code must read ALL characters in the string before it 'parse' the line into variables. setDo, 1 and 1. secondly it is not good programming practice to separate values with spaces as it could limit future features. We use the '~' as seperator because the chance of that in a 'sentence' is about NIL. Adie Upvote 0
hi E54 It is better to be specific. 1. Read the string in Arduino 2 or the return value in B4R Etc etc. Also sometimes 2 line code snip will give us even better idea of what and how you did it. OK I'll assume that you send the string setDo 1 1 with B4R to the arduino. the arduino code must read ALL characters in the string before it 'parse' the line into variables. setDo, 1 and 1. secondly it is not good programming practice to separate values with spaces as it could limit future features. We use the '~' as seperator because the chance of that in a 'sentence' is about NIL. Adie
Erel B4X founder Staff member Licensed User Longtime User May 25, 2016 #4 There are several examples that can help you to communicate with the PC: Controlling an RGB Led from the PC https://www.b4x.com/android/forum/threads/arduino-raspberry-pi.65820/#content https://www.b4x.com/android/forum/threads/tool-external-serial-connector.65724/#content Upvote 0
There are several examples that can help you to communicate with the PC: Controlling an RGB Led from the PC https://www.b4x.com/android/forum/threads/arduino-raspberry-pi.65820/#content https://www.b4x.com/android/forum/threads/tool-external-serial-connector.65724/#content