Control a digital output from code

Hi to everyone.
I’m almost finished my plugin but i can’t use the digital output of the robot.
I want to control a digital output from a button on the screen, but i don’t know how to do this.
Can anyone help me ?
Thanks to all of you!!!

I recommend you that look this post. I hope it’s useful

I downloaded and implemented this aproach and it works thanks !!!