Difference in outcome Laptop / Tablett

Hello forum,

I have my program on my Arduino, and it's connected via USB Type C. It's waiting for an input (string), and then a motor should move a distance sheet metal to a certain distance.

Now, when I use my laptop to send this string to the Arduino, the outcome is different compared to when I send it with my tablet (Laptop = HP, quite new; Tablet = Microsoft Go).

Can someone explain what is going on?

Thanks in advance,
Gregor

I moved your topic to an appropriate forum category @user110697.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Hi @user110697. Please provide a detailed description of how you are sending the string.

I didn't program the code to send the data from the device to the arduino. Only what the arduino does with the input, it is:

#include "Communication.h"

void Communication::handleInputString(String inputString) 
{
  switch (inputString[0])
  {
    case 'L':
      this->_lengthToCut = (inputString[1] - '0')*1000 + (inputString[2] - '0')*100 + (inputString[3] - '0')*10 + (inputString[4] - '0');
      this->_lengthComplete = true;
      break;
    case 'C':
      this->_commandNumber = (inputString[1] - '0')*1000 + (inputString[2] - '0')*100 + (inputString[3] - '0')*10 + (inputString[4] - '0');
      this->_commandComplete = true;
      break; 
    case 'T':
      this->_testNumber = (inputString[1] - '0')*1000 + (inputString[2] - '0')*100 + (inputString[3] - '0')*10 + (inputString[4] - '0');
      this->_testComplete = true;
      break;
  }
  if(this->_lengthComplete)
  {
    this->_lengthComplete = false;
    myStepper.SetLimiter(this->_lengthToCut);
    this->_lengthToCut = 0;
    Serial.println("C1002"); //Limiter set
  }
  if(this->_testComplete) // For Tests
  {
    this->_testComplete = false;
    //TurnMotor360();
  }
  if(this->_commandComplete){
    this->_commandComplete = false;
    switch(this->_commandNumber){
      case 2000:
        if(_lastStatus != NULL && *_lastStatus != "") Serial.println(*_lastStatus);
        break;
      case 3000:
        SC.getStatus(true);
        SC.serviceDriveNew();
        break;
      case 3005:
        SC.getStatus(true);
        break;
    }
    if(this->_commandNumber >= 5000 && this->_commandNumber < 6000){
      this->_limiterRefDistance = this->_commandNumber % 5000 + 0;
      myStepper.setRefDistance(this->_limiterRefDistance);
    }
  }
}

The input is in mm and contains 4 digits

That code contains the reason of the different reaction. If you can not present the code, at least the data transmission part, nobody can help you.

1 Like

So how do you know that the two devices are actually sending the same thing?

That would be the first thing to check ...

Ok thank you. I will organize the information (on monday)
hope with that it's possible to solve the riddle

Is the sending device just seeing the Arduino as a COM port?

If so, you could just use a terminal to see what is being sent.

Or update your Arduino sketch to "echo" what it's receiving on another serial port, and examine that in a terminal...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.