Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Sample arm motor
Forum Updated to NodeBB v4.3 + New Features

Sample arm motor

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 155 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rockerz
    wrote on last edited by Rockerz
    #1

    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);
    }
    
    C 1 Reply Last reply
    0
    • R Rockerz

      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);
      }
      
      C Offline
      C Offline
      ChrisW67
      wrote on last edited by ChrisW67
      #2

      @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?

      1 Reply Last reply
      4
      • R Rockerz has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved