A real time graph



  • hi
    i m working on embedded devices. in which the hardware device can be operated or control by software. and the same time we can read the incoming data from hardware with the software which we embedded with hardware and can write data too via serial port.
    In this serial communication the first step which is reading or writing data in the form of digits i completed.

    now i m on second step in which i want to draw the graph of incoming serial data .. in this i can use either QcostomPlot or Qwt .
    i read about both also run their examples but there is no any perfect example or soution which i can use.

    i have the hardware with 0xFB,0xFC,0xFD and 0xFE specifiers by which i want to read 4 different parameters and need to plot graph for same .

    for a start i tried temperature reader with graph using arduino

    void Dialog::receive()
    {
        char data[255]; //creation of a char aray
        int bytesRead = arduino->read(data, 255); //load the port data
        data[bytesRead] = '\0'; //end the char aray
    
    
        //we convert the char into a integer
        int i=0;
        if (bytesRead==1)
        {
            i = data[0];
        }else return; // if the data size is different from 1 => exit the function
    
        QTextStream out(stdout);
        out << data << " (" << bytesRead << " bytes) understood :" << i<< endl; //writing the data read in the console
    
        addpoint(i); //we add a point to the graph
    
    }
    void Dialog::addpoint(int point)
    {
        data_x->push_back(data_x->size());// add the point to the data
        data_y->push_back(point);
        curve->setSamples(*data_x,*data_y);// we set the data to the curve
    
        plot->replot(); // we redraw the graph
    }
    

    u can see this on "http://www.instructables.com/id/Make-graphs-on-Qt-and-plot-your-arduino-measuremen/"

    but this too not working.. i dont know what to do .

    plz anyone help me .

    and one thing also, i have full code of my topic in vc++ 6.0 but i want it in Qt . and i dont know how to convert my vc code in qt because i m not used to to qt.

    so plzz plzz plzz help me

    thank you in advance


  • Qt Champions 2016

    Hi

    Which part is not working?

    Dialog::receive() is never called ?

    Or you do get the data and correct / expected values are adding
    in addpoint(i) ? But nothing is plottet?

    full code of my topic in vc++ 6.0

    Well anything MFC must be recreated in Qt using widgets.,
    Pure c++ code will still work.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.