.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

Control leds on mini2440 by a Qt Creator's program

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

Mini2440 board has four leds that is used to indicate the status of the board. Normally, the leds will run when led service is loaded. However, we can use command to stop or restart that led service, they are:
$/etc/rc.d/init.d/leds stop
(after this command, leds will stop blinking)
$/etc/rc.d/init.d/leds start
(after this command, leds will start blinking)
 I wrote a QtCreator's program that passes those two commands by pressing button, the leds will stop or start running then. The source code of that program can be found at link here.
In Qt, there are two things you should know, they are "slot" and "signal". For example, when you press on button, it means you give a "signal"; then, that "signal" will trigger (all thing in) a "slot".


In the source code at above link, you will find those line:
void MainWindow::on_pushButton_2_clicked()
{
    system("/etc/rc.d/init.d/leds stop");    //stop led-player
    system("/etc/rc.d/init.d/leds start");    //start led-player
}


So, when you press (click) the pushButton_2 (giving a "signal"), then the sub-program ("slot") named MainWindow::on_pushButton_2_clicked() will run.
I just briefly introduce about programming in Qt, for more deeply in this issue, please take more day in book. My book at the first day programming Qt is "C++ GUI programming with qt4" (author: Jasmin Blanchette and Mark Summerfield), it is easy for newcomer, hope it will help you too.

Leds on mini2440 is controlled by device driver located at /dev/leds. So, we just open that file, pass it some data, that's it, the leds will light or not as in received data.
For example, in the source code, open the file and write data in order to control leds:
                int fd;
                if((fd=open("/dev/leds", 0))<0){
                        ::close(fd);
                        return;
                }
                ioctl(fd,0,0);    //led0 off
                ioctl(fd,0,1);    //led1 off


Once again, to understand more, we have to work with book again. There is a excellent book that i found, it is "Unix System Programming" by Keith Haviland, Ben Salama. This book will teach us how to open, write, delete, ... a file, and more.
And here, here is my program running in mini2440 board


Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel Control leds on mini2440 by a Qt Creator's program, Diterbitkan oleh scodeaplikasi pada Jumat, 14 Februari 2014. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to