18 Eylül 2018 Salı

arduino ile potansiyometre ve buzzer calıstırma


void setup()
{
  pinMode(A2,INPUT);
  pinMode(A3,OUTPUT);
  Serial.begin(9600);

}

void loop()
{
  int konum=analogRead(A2);
  konum=map(konum,0,1023,0,255);  // 1024 aralıgında ise 0 ,255 aralıgına düşürür
  Serial.println(konum);
  delay(50);
  analogWrite(A3,konum);
}




// BUTTON İLE LED YAKMA


void setup()
{
  pinMode(LED,OUTPUT);
  pinMode(BUTON,INPUT);

}

void loop()
{
  if(digitalRead(BUTON)==HIGH)
  {
    digitalWrite(LED,HIGH);
  }
  else
  {
    digitalWrite(LED,LOW);
  }
}

Share:

Mutex with QT

*mutex kullanımı
//myhtread.h
#ifndef MYTHREAD_H
#define MYTHREAD_H
#include < QtCore >    

class MyThread:public QThread
{
public:
    MyThread();
    void run();
    QString name;
    bool Stop;
};

#endif // MYTHREAD_H




//main.cpp
#include < QCoreApplication >
#include "mythread.h"
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    MyThread m1;
    m1.name="first thread";

    MyThread m2;
    m2.name="second thread";

    MyThread m3;
    m3.name="third thread";

    m1.start(QThread::HighestPriority);
  //  m2.start(QThread::LowestPriority);
  //  m3.start();
    m1.Stop =true;
    
    return a.exec();
}



// thread.cp
#include "mythread.h"
#include < QtCore >  // UNUTULMAMALI CORE KULLANILACAK 
#include< QDebug >

#include < QThread >
MyThread::MyThread()
{

}

void MyThread::run()
{

    for(int i=0;i<10;i++)
    {
        QMutex mutex;
        if(this->Stop)
        {
            break;
        }
        mutex.unlock();
        this->sleep(1);
        qDebug() << "Runnning"<<name <<"   : "<< i;

    }
    
}

Share:

Create Threate with QT

*Thread olusturma
1)ilk olarak bir proje olusturulur
2)yeni bir class eklenir
3)yeni olusturulan classa #include   eklenir  ve class ile :public QThread miras alınır 
4)public olarak run() fonksiyonu yaratılır
5)main cpp de ise #include    ve #include "mythread.h" ile class ana uygulamaya eklenir 
6)class source file kısmında(thread.cpp de )  run fonksiyonunda yapılmasını istedigimiz işleri yazarız
void MyThread::run()
{

    for(int i=0;i<10 i="" p="">    {
        qDebug() << "Runnning"<
    }
}
6) istedigimiz kadar threadi artık olusturup start ile baslatırız
    MyThread m1;
    m1.name="first thread";
m1.start();
Share:

4 Eylül 2018 Salı

HOW TO FFMPEG

*open cmd and go /ffmpeg/bin


1)video information //ffmpeg -i video.mp4
2)convert video //ffmpeg -i video.mp4 video.avi 
3)if you want preserve quality : 
ffmpeg -i video.mp4 -qscale 0 video.avi
4) if you want to see supported formats 
// ffmpeg -formats
5)change resolution // 
ffmpeg -i input.mp4 -s 1280x720 -c:a copy output.mp4
6)compres audio files 
//ffmpeg -i input.mp3 -ab 128 output.mp3
7) Removing audio stream from a media file
ffmpeg -i a.mp4 -an no_voice.mp4
8)Removing from video from media file 
ffmpeg -i a.mp4 -vn no_video.mp4
9)extracting image from video file 
ffmpeg -i a.mp4 -r 1 -f image2 image-%2d.png
10) crop video
ffmpeg -i a.mp4 -croptop 100 -cropbottom 100
 -cropleft 300 -cropright 300 cropvideo.mp4
11)specific crop (minute/second)
ffmpeg -i a.mp4  -t 50 specific_crop.mp4  
(first 50 seconds)
12) set aspect ratio to video
ffmpeg -i a.mp4 -aspect 16:9 aspect.mp4
13)view video 
ffplay a.mp4
14)change speed video 
ffmpeg -i inputvideo.mp4 
-vf "setpts=0.5*PTS" outputvideo.mp4
Share:

17 Temmuz 2018 Salı

Qt Translator Kullanımı ve Linguist



















*Uygulamamıza çeviri desteği ekleme için ilk olarak Qt Komut satırını açıyoruz ve projemizi ana dizinine geliyoruz

cd C:\Users\slymn\Documents\GitHub\D_Player

* çeviri dosyamızı oluşturmak için ise komutumu yazıyoruz .

lupdate -pro QDtsis_Plyer.pro turkish.ts

*Başlattan Qt Linguist uygulamasını açıp Proje klasörümüzde oluşan .ts dosyasını açarız . çevirileri ekleriz

* Qt komut satırında .qm dosyasını oluşturmak için komutumuzu yazarız

lrelease turkish.ts

ve artık turkis.qm dosyamız oluştu

*Qt ile projemizi açıp add new resources secerek "turkish.qm" ekleriz

* Main.cpp de ;

 QTranslator translator;
 translator.load(":/turkish.qm")
 a.installTranslator(&translator);



NOT:  Eğer ui üzerinden widgetlara text değiştirdi isek Qt  translate edecek halde eklemektedir ve Linguistte görünmektedir  ama eğer manuel setText yapıyorsak ozamn başına tr eklemeliyiz

ui->device_information_refresh_btn->setText(tr("Device Status Refresh"));
Share:

16 Temmuz 2018 Pazartesi

Video ile Genel Bilgiler

Frame Rate :  Saniyede geçen kare sayısı   12 Fps, 24 Fps ,6Fps

BitRate : Geçen karenin boyutu

Resolution : Çözünürlük

                   d1 (704 x 576)
                   ciff(352x288)
                   VGA(640x480)
                    full HD(1920x1080 p)  60hz
                    full HD (1920x1080i) 50 hz ama normalde 25 hzdir bir tek satırı bir çift satırı tarar 50 hzmiş hissiverir 
Share:

5 Temmuz 2018 Perşembe

Play gif and movie with qt

#include 

//.h 

    QMovie *movie;

// .cpp

     movie = new QMovie;
     movie->setFileName("gif");
    ui->mv_lbl->setMovie(movie);
    movie->setScaledSize(QSize(100,40));
    movie->start();
    movie->stop();

Share: