i am trying to send data through the RS232 Node to an Arduino.
so far i have this Arduino code:
vvvv_Receive_Varchars.zip (1.1 KB)
and this Patch:
I don t get it working.
Strange thing is that after the Sift Node i see a number like 1 and after the AsRaw node i see 31.
What am i doing wrong?
i am afraid from your screenshot i don’t really understand what exactly you want to send. can you describe that in words to help us understand your goal?
the value returned from sift is an Integer value of 1. you’re then using AsString to convert it to a string of value “1”. then you’re using AsRaw (String) to convert that string to its corresponding ascii-byte value which is 31. so that all makes sense actually.
Hi joreg, thank you for your reply. I simply would like to send a integer number like “1” over to my arduino but the input of the RS232 node does not exepts the output of sift. so i tried to covert the value to make it match the expected format.
ok. so the only things you can send over serial are raw bytes. this means that you need to convert whatever you want to send to bytes first. the tricky thing is to understand if the receiving end expects to interpret the bytes it receives as a string (or char), like “1” or as an actual integer number, like 1.
it seems your arduino code expects the integer in the form of a string, like “1”. so in that case what your doing:
- first convert the int to a string using AsString
- then convert the string to raw bytes using AsRaw
is the correct thing to do. you’re sending a byte of value 31 which represents a string of “1”. arduino will receive that byte and when again interpreted as string it will see a “1”.
so this part doesn’t seem to be the problem.
what i understand much less is the part above the Sift. what is this exactly supposed to do. can you describe that in words?
I read in a barcode with a barcodescanner, clean it up and compare it with sift.
According to the match i send the corresponding index to my arduino.
huh, ok. barcodescanner was the missing thing here for my understanding… so if that above part works as you need it, i can only say that from all i see also the part below the sift should do what you need.
I added a AsString Node on the output of the RS232 to see what is been send and unfortunately i don t see any output. Everything before works perfectly. At the arduino i see the rx Led flashing so something is happening but i don t see/understand what charaters to expect at the arduino serial port. Thing that makes this more complicated for me is that you don t can listen to the Serial Monitor of the arduino ide while the serial port is used by the transmission of vvvv.
first: the “System Default” encoding looks wrong. you had “us-ascii” chosen in the above screenshot, which is more likely what you need.
then: so you’re expecting the arduino to send something back… are you sure it does? from quickly browsing over the code you attached, i don’t see this happening.
i changed it back to “us-ascii”. I found out that it works if i send “words” but not if i send numbers. It a workaround but i would like to understand why it does not work with numbers.
No i am not sending nothing back from my arduino i was trying to see if the input is passing through to the output.
I have noticed one more thing. The communication with the arduino works only if i unplug it and plug it again while the vvvv patch is open. Why is this happening?
i am afraid i cannot follow what you mean with this. but it works as expected now?
Yes. I can send a word like “one” and receive it on my arduino. Do you have an idea why the arduino is not working immediately after starting the patch? It works if I start the patch and than disconnect and reconnect the arduino usb cable.
i’m afraid i am out of ideas of how to help you here.
no, i’m afraid i don’t know.
if this is a problem thats blocking you, you could try to see if this works in vvvv gamma.
Thank you! I will give it a try.
Is vvvv gamma serialport node running more robust?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.