Important: Please read the Qt Code of Conduct -

Toggle an LED from within Qt

  • I have Qt up and running on my custom AT91SAM9G45 hardware using Linux 2.6.30 kernel and all of the Demos work nicely with my touchscreen and 480x272 LCD. So, I figured that I am a good point so far. Now, I have only messed with Qt for two days and I have a very simple question I hope.

    How, do I toggle an LED. (I have my Qt books coming from Amazon next week so sorry of this was a stupid question). I am assuming that Qt can access all of the hardware that Linux can access?

    My LED driver(s) location:

    My LED variable:
    brightness (can be zero or one)

    From the console I can:
    echo "1" > brightness
    echo "0" > brightness
    cat brightness

    Thanks, Gary

  • Hi,

    I haven't personally done anything with Qt in a custom embedded environment like this, so it's entirely possible that I'm wrong about this, but you will probably be able to use normal file i/o (QFile and friends) to write to the device file which "brightness" is a symlink to.


Log in to reply