Send Serial data fade LED


I have issues fading an LED on my Arduino board using the rs232 - node.
I´m not able to realize a smooth fading of the brightness of the LED when I´m moving the faders in vvvv. The LED just stutters irregularly.
See the screenshot and the attached sketch. I also added the Arduino sketch which receives the Serial data coming from vvvv.

I have already tried to send serial data from Javascript to Arduino using the same Arduino sketch. This works without problems. Inside Javascript, I used the setInterval() - function which only wrote the data 10 times a second to the serial port.
Maybe vvvv is sending too often serial data to the Serial port??
Can I define a setInterval() are something similar in vvvv, too?

Has anyone an idea how I can fade my LED smoothly in vvvv?
In my patch I tried to set a kind of interval to the R - channel, but this does not prevent the rs232 node from writing serial data to the serial port as often as before.

Well, I know the way with Firmata (which is indeed able to realise a smooth fading), but unfortunately I can´t use it, because I´ve got a lot more things to specify in my Arduino sketch, as I´m going to distribute the incoming value over an i2c network to several slaves.

Who has an idea?

SendSerialWithIntervals.v4p (22.6 kB)
HexToArduino.ino_.txt (2.8 kB)

without trying to understand your particular problem… have you read through: hardware#arduino
it has pointers to literally tons of examples. do they help?

Unfortunately I can´t find any solution for my issue :-(
In brief: I need to find out how vvvv can send serial data this way the LEDs on the Arduino board fade smoothly.
I have no insight in what the FirmataEncode node does, but this node realizes a smooth fading perfectly.
If someone can teach me …
I have been trying lots of alternatives for months but I´m coming back to vvvv because I can´t believe that there is no solution!

hi try send you decimal values converted via spellvalue in ascii mode (byte) then send the serial to arduino .

I haven’t verified that this works now since I don’t have the hardware available but my memory tells me it at least used to work fine ~months ago…

edit: noticed it relied on two plugins so added them to the zip (23.7 kB)

In the arduino code, the only delay I see is delay(3), so you should be able to send 333 values/second. Your patch isn’t running that fast (check that using the timing node).

If the Firmate node works for you, why not just use that and forget about the other code? I don’t know what hardware setup is, but if it is as basic as having R,G,B LEDs PWM-ing at pin 9,10,11 you can save yourself a LOT of trouble.

About your patch:

First you use a value from 0 - 255, and than you map that back to 0 - 1.

Forget what you know from DMX/8bit and stuff, keep your vvvv values between 0 and 1 in vvvv, so RGB, LFO’s and many other nodes can talk to each other without you having to use the MAP node all over the place.

FirmataCouldWork.v4p (17.8 kB)

Hello wurstbrotrest,

please check this example in your vvvv directory:


It shows how to create and exchange your own simple messages with Arduino. This example smoothly fades the LED. A bit more things than you need are hapenning there, but look at the Step 2. There is a Limiter (Animation) node which limits how many times per second the values are sampled.

Does this help?


So many good answers at so little time!!
I should have asked earlier :-) I´d have saved a lot of time.

colorsound´s idea did not work for me.
beyon´s wishbox is great! There are some very useful snipplets inside. I spent the last hours checking them out.

I will check out westbam´s and robotanton´s solutions soon.
I will keep you up to date.

Until now: Thanks a lot!!

hi i made you an example i just clean and puts some notes, you can do it in other ways as well. i use this way quite often.

SendSerial2Arduino.rar (9.3 kB)

I´m the happiest!
Having tested and modified beyon´s Wishbox yesterday, I now enjoyed colorsound´s example ‘SendSerial2Arduino.rar’. I must correct myself: It is well understandable, clear and it works perfectly. It doesn´t need any .cs-plugins as beyon´s Wishbox does.
I think, this is just the right thing I was looking for!

Your example is clear, too. In fact, your solution is quite similar to colorsound´s. If I hadn´t been too lazy to update to the current vvvv girlpower folder (31_2) until now, I would have seen this new example earlier!!
It´s only a short while ago, I got lost in girlpower\The Next Generation…

Of course I know the way through Firmata.
In my case, however, I have to stay a bit more flexible on the Arduino side.
I can´t simply turn my Arduino-board into a brainless slave as it is the case with Firmata. Without the need the need of more flexibility I wouldn´t care about other solutions than Firmata.
But now, I´ve got it.

@all: Thanks so much for helping. This is a great thread (not even one day old).

:D Brilliant!!