Turn screen on/off on Raspberry ?

Hi all,

I did look into Xojo in the past (when it was called RealBasic), and was happy to discover that it currently supports Raspberry Pi.
I’m looking into different programming languages, to see which fits the best for my RPI home automation project renewal.
Actually, I think Xojo will do fine (I’m also charmed by the idea of compiling for OSX & Windows also), there is only one issue left, blocking my final decision.
Is there a way to programmatically turn the HDMI output on the RPI on/off ? (like the power options, putting the screen to sleep after 10 minutes)

I want to turn a 9" Sainsmart TFT module “on” programmatically, and also turn it off again programmatically.
Can anyone confirm that this is possible with Xojo and point me out to some sample code to accomplish this ?

sorry for my bad English,
best regards from Belgium,
Kris

Check this link have some information about displays.
Maybe you get idea and adapt the code in xojo
link
If you have problems to adapt the code to Xojo just use or create a python script and use it from shell…

Thank you for your reply.
the link did not actually solve my problem, but it did lit a spark, so I could solve it myself :slight_smile:

turning the screen off:

dim mShell as new shell mShell.Execute("tvservice -o")

turning the screen back on:

dim mShell as new shell mShell.Execute("tvservice -p;chvt 9 && chvt 7")
(after turning the screen back on, you need to refresh X, but ‘xrefresh’ does not solve this.
So changing to terminal 9 and back to terminal 7, solves this)

howoever, tvservice & chvt needs root permission, so you need to modify the permission of both, to run it without ‘sudo’:

chmod u+s /opt/vc/bin/tvservice chmod u+s /bin/chvt

Works like a charm :slight_smile: I will use the rest of the weekend to read and experiment with Xojo,
and on monday I will place my order for Xojo licenses !

anything you can do with the shell you can do with xojo
and with the raspberry you have the gpios you can manipulate and switch what you want also
or even use an arduino with wifi (aka an esp8266) and send a command via wifi to the device that switches on or off what you need

there is always a solution.