VVVV to arduino using rs232 (not arduino to vvvv)

The problem.

I’m trying to get 2 float values from vvvv into Arduino via the rs232 node over serial. I would like to continue to use the rs232 rather than try firmata as I the robots head is controlled via stepper motors that have their own custom libraries and I have spent quite a while tweaking it.

I have attached my patch and my Arduio code in the hopes that someone may have solved this before and be reveal a solution.

Ive asked for a lot of help this week but know that I appreciate it.

If anything is to vague then just ask.

*the second txt file is the arduino patch

rs232_arduino.v4p (14.4 kB)
servoserial_simple.txt (1.5 kB)

maybe this link helps?

seems like the rs232 node sends out some funky output on the serial side as I cant get consistent values through. I don’t want to stuff around with what ever is broken with the string misinterpretations so instead Ive just used firmata via puredata via osc through v4. Stupid things is then to run all the other stepper stuff I need 2 Arduinos…one for the firmata and then out over analog to the robot controller…so not funny

hei nava,

you say you need to send 2 float values from vvvv to arduino, but in your samplepatch you’re trying to send a string of: 1332a.

so i am not entirely sure i get the thing, but!
are you by any chance on a chinese or other non-central-european windows system?

RS232 (Devices String) has a hidden Encoding, only visible in Inspektor, that defaults to System Default. please try setting that to us-ascii and see if it makes a difference.

Ok I sorted the serial message out now through the rs232(devices string) I did have befor that a version from someone else and the node was a little different. They seems to have some mismatch problems with the latest 64bit release or if its just the latest release…opening the help patch of a spreadable rs232 spreadable has errors in it. I think someone needs to look into what ever was done to the rs232 device in the last release(I can see that someone modified it to use spreads). Actually it seems that the rs232.dll is missing in the 64bit release of vvvv_45beta29.2_x64

Anyway I used the example that has the (AsRaw) connection to the input rather than a string connection and this worked for me. I did have a hard time finding out why my message were going all wacky until a friend told me that its probably because of a buffer overflow. Turing of all the print messaged fixed this and now my Arduino is able to listen to vvvv.

If you have a look in the first example i posted it has a string connection, and the one I’m using now needs AsRaw. Perhaps in that first patch i was just getting also a buffer overflow. Ill post a little bit of code latter that explains the buffer problem as its confusing to actually tell in v4 unless u set up a log file to see all the printed arguments returns from Arduino.

missing in 64bit builds lists the spreadable rs232 plugin as still missing. so thats official.

regarding the not working RS232 (Devices String) please see https://discourse.vvvv.org/

Im on a standard system and the problem like I say was due to a buffer overflow. Ive got it working with the sample patch that comes with the last release with the AsRaw input. As far as I know from Arduino I was using the string value in the first patch because thats how we were reading it in with arduino as I was lead to believe that for example here is part of the loop i used in arduino

if (Serial.available())  
  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == 'a') 
	{
		//Serial.print("v4: ");
		//Serial.println(readString+c);
		
		if (readString.length() >0) 
		{
			int n = readString.toInt();  //convert readString into a number
			//Serial.println("setting servo A to: ");
			//Serial.println(n); //prints string to serial port out
			servo_a.write(n);
			readString=""; //clears variable for new input
		}

i asked for your system locale since i believe on non-european systems the string-version can possibly not work.

when you say you’re on a european-system and still only the RAW version works for you that is strange. there should not be a difference between the two that could be argued with a bufferoverflow…

ok so it does work with the rs232 string node now:/ it took some time to get the code right and I was having some problems getting ints vs floats. I just tested the as string node again and seems fine with the above code. I did get a little tricked when I was printing multiple values back to v4…could clearly see it was a buffer overflow in that case and thought that that may have been the case when using the string version but didn’t test that.
should have been more thorough.

I guess the code isn’t rocket science but its a nice little example of how to read in as one or as many int values as you need for vvvv to Arduino. I like it anyway because I have a bunch of other stuff running on my Arduino and didn’t want to have anything to slow it down.