Control a digital output from code

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