Handle Arduino data

hi all,
finally i can retrieve data from arduino into vvvv, but now i have a couple of question in my mind(i hope somebody can help me):

_can i divide two input from the same board?i explain:
the rs232 node let me choose among COM1 COM2 COM3 etc…
but can i choosefrom which imput retrieve data?
if i connect two push button to the same board,can i choose which push button control what?

_in the serial monitor(arduino.exe) now that it work i have a lot of simbols meaningless,before i had some values(on a poti from o to 1023) WHY?

TNX ALL

Bardo

Yo Bardo,

The Arduino, I assume you mean the USB version, is one board. And the driver is a virtual COMport, so it looks to VVVV as a serial device. This means that it only uses one COMport to communicate with your computewr (or VVVV).

Serial communication is a 2 way street, you can send commands/data from VVVV to the Arduino, or the other way arround, sending commands/data from the Arduino to VVVV.

The Arduino is a microprocessor, and as you might have seen, it has loads of input/output pins. 13 Digital (can only state ON or OFF) and 6 analog (can read between a range off values, like your Potimeter can generate). You set the function of these pins in the code off the board.

I asume you have read what MrBenefit has done with the Arduino. Look at his Example arduino03.

And more inportant, look at the code you need to upload to the board. You need to learn a bit off coding to use the board, that is a pitty (compared to VVVV hard). I am not going through the entire programm, but the secret for your quaestion is here:

val = analogRead(potPin); // read the value from the potentiometer
printInteger(val); // print the value to the serial port

First we make a variable (they choose the name Val) and store the value off the potmeter in there, than we use the printInteger Command to send that Val (or in other words, send the value off the potmeter, that is stored in Val) to the serial port. And in VVVV you can read it as a String with IOBox (String) .

Now, here is the funny part, you can send TEXT from the Arduino, and also programm that!! Eeverything you send to VVVV will be treated like a Text String!!

So, if you want to read more buttons, you migt want to add a line off text first saying: here comes button one, here button two etc… But be smart and replace that Line with a letter.

The ARDUINO webpages is offline ATM, so I cannot send you some example code. I haven’t done more than reading, and making a nightrider LED thing (yet). But I did play arround with VVVV and buttons, because I am after the same thing.

I will post you some code as soon as they are back.

edit: the whole idea is a bit like we decided to comminicate between Visual Basic and VVVV. (create your own protocol) But you need to dive a bit deeper in the way you programm the Arduino.

edit2: I will post a small demo off the use off 2 pushbuttons and Arduino later today, with pictures and source (if I got it to work again, that is ;) )

edit3: Oops, I needed some reistors for my push-button tut, and I am fresh out :/

tnx west,
now i understand something more,but its quite hard to me (i’m not a programmer).
i alreardy understood that the way is work with string, but its hard for me…i come from actionscript,and processing its not so hard ,but in vvvv is another thing…expecially when the string i retrieve seems to be meaningless.

Now im at work ,and i can’t post nothing,i’ll upload the patch this evening,but ,if u can upload a small demo ,i’ll really appreciate it!!!

tnx another time

bardo

Read THIS topic on the arduino website, and you will see what I mean, a way to identify your values in vvvv, so you know what sensor/button/switch/etc… they originate from.

My resistor dealer is closed on friday… man!!! just a lousy 2.2 KOhms…!!

tnx west ,i’ll try tomorrow,you’ll see…

this is the packages,arduino and vvvv,ther’s something 2 adjust(i use only5 of 9 input) but i think this is the way.

Another question:-is there a way 2 send a 0 input to all layer when 1 is pressed(to dont have 2 video playng togheter,but just 1 each moment)?

tnx all Bardo

due.v4p (69.1 kB)

???.. no text …

Arduinostring.rar (6.3 kB)

Here’s a short tutorial I made on how to handle multiple signals in arduino-vvvv communication. Includes vvvv patch and arduino code to communicate all 6 arduino analog inputs.

It just extends Mr Benefit’s work a little bit.

Sry Bardo, kind off forgot about this.

Wow Neilzero!! Exelent tutorial!! Thnx for this :)

“executing a regexp every frame is expensive expensive” what you mean with that? (I assume heavy for the proccesor)