Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Toggle an LED from within Qt
Qt 6.11 is out! See what's new in the release blog

Toggle an LED from within Qt

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PowersOf12
    wrote on last edited by
    #1

    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:
    /sys/devices/platform/leds-gpio/leds:led1
    or
    /sys/devices/platform/leds-atmel-pwm/leds:led2

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

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

    Thanks, Gary

    1 Reply Last reply
    0
    • C Offline
      C Offline
      chriadam
      wrote on last edited by
      #2

      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.

      Cheers,
      Chris.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved