Use Arduino data

Hello everyone, I have just been using touchdesigner and I am self-taught.
I would need to turn off a projection when a key is released on the arduino.
I have already loaded the sketch on arduino, I have already read 0 when the key is released and 1 when the key is pressed via touchdesigner with a serial DAT, but I don’t know how with these two values (0 and 1) I can make sure that there it’s dark on the final rendering of my project.
I attach the project to make you understand!
Thanks in advance.


ShareProject.toe (88.9 KB)

Hi there,
You can use that Arduino incoming value to drive a cross TOP, to fade between your render and a black screen.

insert a cross TOP between that level TOP and the null TOP.
attach a constant TOP to the cross second input, make it black and make sure that the constant TOP has the same resolution as your render.
Now reference that null9 CHOP to drive the cross TOP value 0 to 1.
To smooth the cross fade between your render and the black constant TOP you can insert something like a Lag CHOP between the datto CHOP and the null CHOP. Set the Lag to your like.

Alternatively you can use the null9 to reference something like the brightness parameter inside the Level TOP.
but in a similar case I would leave the Level TOP alone, in case you need to tweak the brightness or other setting, independently from the cross fade.

Hope that helps!

Wow, it was easier than expected
Thanks so much!
my only problem is that from the serial port when I go to make the selection I carry 0 1 behind me, this creates problems because the cross detects 0 as the main value and therefore nothing happens.
How could I eliminate the 0 before the changing value (which comes from arduino?)

Thanks again very kind!

I did it
I basically changed the settings in DAT TO.
Thanks so much!