Sample arm motor
-
how to write command for increment and decrement for position in sample arm motor? From this code position button clicked set value as 1000 and increment & decrement operation not work?
This is command for position.void MainWindow::on_position_Reference_clicked() { QByteArray bytearray; bytearray.resize(1); bytearray[0]='#'; bytearray[1]='1'; bytearray[2]='P'; bytearray[3]='='; bytearray[4]='0'; bytearray[5]='1'; bytearray[6]='0'; bytearray[7]='0'; bytearray[8]='0'; bytearray[9]='!'; serial->write(bytearray); } -
how to write command for increment and decrement for position in sample arm motor? From this code position button clicked set value as 1000 and increment & decrement operation not work?
This is command for position.void MainWindow::on_position_Reference_clicked() { QByteArray bytearray; bytearray.resize(1); bytearray[0]='#'; bytearray[1]='1'; bytearray[2]='P'; bytearray[3]='='; bytearray[4]='0'; bytearray[5]='1'; bytearray[6]='0'; bytearray[7]='0'; bytearray[8]='0'; bytearray[9]='!'; serial->write(bytearray); }@Rockerz "Increment & decrement operation not work" is not a useful description of the problem. The code did not compile or link? The command did not get sent? The command did not get acted on? The command caused unexpected behaviour? How does "increment or decrement" relate to the characters you are trying to send? We can only guess.
See QByteArray::operator[](), note the condition on the index value. Look at QByteArray::resize(); how many bytes are in the array?
What is actually in the array you write?Look at the manual for the device on the other end of the serial connection. Is it expecting command to be terminated with a carriage return and/or line feed?
-
R Rockerz has marked this topic as solved on