Hi all,

I am new to qt, I am trying to make a gui to control my stage(based on stepper motor). it uses udp protocol to send commands. command structure is as:
header =07 ( 2 bytes)
command to move = FL10000 ( to move 1 cm)
termination <CR> = 13

I made a push button and created slot for the same shown below:

Qt Code:
  1. void MainWindow::on_move_1cm_clicked()
  2. {
  3. QByteArray datagram;
  4. datagram[0] = 0;
  5. datagram[1] = 7;
  6. datagram[2] = 70;
  7. datagram[3] = 76;
  8. datagram[4] = 45;
  9. datagram[5] = 49;
  10. datagram[6] = 48;
  11. datagram[7] = 48;
  12. datagram[8] = 48;
  13. datagram[9] = 48;
  14. datagram[10] = 13;
  15.  
  16. QUdpSocket udpSocket;
  17. udpSocket.writeDatagram(datagram, QHostAddress("10.10.10.10"),7775);
To copy to clipboard, switch view to plain text mode 

The problem I am facing is on clicking the button at the first time the stage move, but doesnot when I click it again.
to make this code work again i have to power off my motor.
can anyone tell me what can be wrong.
I am planning on having 3-4 push buttons for different length of move.

Please help me out.

thanks.