Help with adapting sketch to work with stepper driver

Hey all. Hope you're all doing well.

Could do with a little advice/pointers as to amend a piece of code/sketch so that it will work with a DRV8834 Stepper Driver.
I know i need to use either the stepper or accelstepper library.

Any questions. Please ask.

I'm assuming all Arduino code is open source so i shall post the code that i need to adapt here.
If for any reason I'm not allowed or the original author wants it removed. I shall do so.

// ScanController Move sketch
// provided input must be 10 bytes
// byte 0    = 'F' or 'M' Fullsteps or Microsteps
// byte 1    = 'F' or 'B' Forewards or Backwards 
// byte 2345 = number of steps 0001 to 9999
// byte 6789 = number of millisec delay between steps 0001 to 9999

#define Pin4   4       // Signal at digital pin 4 Stepper Steuerung
#define Pin5   5       // Signal at digital pin 5 Stepper Steuerung
#define Pin6   6       // Signal at digital pin 6 Stepper Steuerung
#define Pin7   7       // Signal at digital pin 7 Stepper Steuerung
#define Pin8   8       // Signal at digital pin 8 catch reel control 
                       // catch reel motor must only be powered in "forward" mode
                       // in "back" mode the stepper motor pulls the film from the source reel
                       // no motor support needed - motor support would be counter productive
int  readvalue  = 0;   // value read from serial input
int  nrmoves    = 0;   // number of movements to perform
int  stepdelay  = 0;   // number of milliseconds as delay between steps/microsteps
int  compvalue  = 0;   // compare value to verify the transfered string 
int  trnsvalue  = 0;      // transmitted compare value to verify the transfered string
int  error      = true;   // error = false if transmission is OK, that is: if trnsvalue and compvalue are identical
int  skipMsg    = false;
int  startindex = 0;
int  actindex;
int  initSwitch   = 0;
int  bytecount    = 0;  // how many bytes have been read
int  bytenumber;        // number of actually read byte
char serinput[12] = { 'F','F','0','1','0','0','0','0','1','5','0','0' };

void setup()
{
  pinMode (Pin4, OUTPUT); // digital pin is output
  pinMode (Pin5, OUTPUT); // digital pin is output
  pinMode (Pin6, OUTPUT); // digital pin is output
  pinMode (Pin7, OUTPUT); // digital pin is output
  pinMode (Pin8, OUTPUT); // digital pin is output

  Serial.begin(9600);      // open the serial port to send data
}


void loop()
{ 
  bytecount  = Serial.available(); 
  bytenumber = -1; 
  error      = true;
  startindex = 0;
  compvalue  = 0;
  while (Serial.available() > 0)
  {
    bytenumber  = bytenumber +1;
    char value  = Serial.read(); 
    actindex    = startindex + bytenumber;
    if (actindex == 0) 
    { 
      serinput[0] = value;
      if (value == 'F')
      {   
        compvalue = compvalue + 1;
      } 
      else {
        if (value == 'M')
        {
          compvalue = compvalue + 2;
        }
      }
    }
    if (actindex == 1) 
    { 
      serinput[1] = value;
      if (value == 'B')
      {   
        compvalue = compvalue + 3;
      } 
      else 
      {
        if (value == 'F')
        {
          compvalue = compvalue + 4;
        }
      }        
    }
    if ((actindex > 1) && (actindex < 10))
    {
      if (value >= '0' && value <= '9')  
      {
        readvalue = value -48;
      } 
      else 
      {
        readvalue = 0;
      }    
      serinput[actindex] = readvalue;
      compvalue = compvalue + readvalue; 
    }
    if ((actindex > 9) && (actindex < 12))
    {
      if (value >= '0' && value <= '9')  
      {
        readvalue = value -48;
      } 
      else 
      {
        readvalue = 0;
      } 
      serinput[actindex] = readvalue;   
    }
	
	// test if provided input has been correctly read
    if (actindex > 11) 
    { 
      Serial.flush();
      skipMsg = true; 
    }
    else
    {
      trnsvalue = serinput[10]*10 + serinput[11];
      if (compvalue == trnsvalue) { 
        error = false; 
      } 
      else { 
        error = true; 
      }
      skipMsg = false;
    }
  }

  if (error == false)
  {
    Serial.println("OK OK OK OK OK OK ");
    delay(25);
    nrmoves   = (serinput[2]*1000 + serinput[3]*100 + serinput[4]*10 + serinput[5]);
    stepdelay = (serinput[6]*1000 + serinput[7]*100 + serinput[8]*10 + serinput[9]);
    delay(stepdelay);
    if(serinput[1] == 'F') // rotate foreward
    {
      digitalWrite(Pin8, HIGH);
      delay(5);
      digitalWrite(Pin8, HIGH);
    } 
    else 
    {
      digitalWrite(Pin8, LOW); 
      delay(5);
      digitalWrite(Pin8, LOW);		
    }

    for (int i = 0; i < nrmoves; i++)
    {
      if(serinput[0] == 'F')   // perform full steps
      {
        if(serinput[1] == 'F') // rotate foreward
        {
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, HIGH);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, HIGH);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, HIGH);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, HIGH);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
        }
        if(serinput[1] == 'B') // rotate backward
        {
          digitalWrite(Pin7, HIGH);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, HIGH);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, HIGH);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, HIGH);
          delay(stepdelay);
        }
      }
      if(serinput[0] == 'M')   // perform micro steps
      {
        if(serinput[1] == 'F') // rotate foreward
        {
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, HIGH);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, HIGH);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, HIGH);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, HIGH);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, HIGH);
          digitalWrite(Pin5, HIGH);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, HIGH);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, HIGH);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, HIGH);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, HIGH);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, HIGH);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, HIGH);
          delay(stepdelay);
        }
        if(serinput[1] == 'B') // rotate backward
        {
          digitalWrite(Pin7, HIGH);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, HIGH);
          delay(stepdelay);
          digitalWrite(Pin7, HIGH);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, HIGH);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, HIGH);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, HIGH);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, HIGH);
          digitalWrite(Pin5, HIGH);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, HIGH);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, HIGH);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, HIGH);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, HIGH);
          delay(stepdelay);
        }
      }
    }
    digitalWrite(Pin8, LOW);
    digitalWrite(Pin7, LOW);
    digitalWrite(Pin6, LOW);
    digitalWrite(Pin5, LOW);
    digitalWrite(Pin4, LOW);
    delay(5);
    digitalWrite(Pin8, LOW);
    serinput[0]  = ' ';
    serinput[1]  = ' ';
    serinput[2]  = '0';
    serinput[3]  = '0' ;
    serinput[4]  = '0';
    serinput[5]  = '0';
    serinput[6]  = '0';
    serinput[7]  = '0';
    serinput[8]  = '0';
    serinput[9]  = '0';
    serinput[10] = '0';
    Serial.flush();
    if (nrmoves > -1) { 
      Serial.println("MoveEnd MoveEnd   "); 
    }
    nrmoves = -1;   
    delay(1500);
    Serial.flush();
    delay(0500);
  } 
  else 
  {
    digitalWrite(Pin8, LOW);
    digitalWrite(Pin7, LOW);
    digitalWrite(Pin6, LOW);
    digitalWrite(Pin5, LOW);
    digitalWrite(Pin4, LOW);
    delay(5);
    digitalWrite(Pin8, LOW);
    serinput[0]  = ' ';
    serinput[1]  = ' ';
    serinput[2]  = '0';
    serinput[3]  = '0' ;
    serinput[4]  = '0';
    serinput[5]  = '0';
    serinput[6]  = '0';
    serinput[7]  = '0';
    serinput[8]  = '0';
    serinput[9]  = '0';
    serinput[10] = '0';
	serinput[11] = '0';
    Serial.flush();
    if (skipMsg == false)
    {     
      Serial.println("ER ER ER ER ER ER "); 
    }
    delay(1500);
    Serial.flush();
    delay(0500);
  } 
}

~350 lines of code. what part of it do you want help with?

Looks like code for a 4-wire stepper driver. Adapting that to a step/dir driver like a DRV8834 would mean significant changes. The chunk above would turn into something like:

...
        if(serinput[1] == 'F') // rotate foreward
        {
          digitalWrite(dirPin, LOW);
          digitalWrite(stepPin, HIGH);
          delayMicroseconds(10);
          digitalWrite(stepPin, LOW);
          delay(stepdelay);
          digitalWrite(stepPin, HIGH);
          delayMicroseconds(10);
          digitalWrite(stepPin, LOW);
          delay(stepdelay);
          digitalWrite(stepPin, HIGH);
          delayMicroseconds(10);
          digitalWrite(stepPin, LOW);
          delay(stepdelay);
          digitalWrite(stepPin, HIGH);
          delayMicroseconds(10);
          digitalWrite(stepPin, LOW);
          delay(stepdelay);
        }
...
1 Like

without using a stepper library, why not write functions to step the motor one step forward and one step backword.

write a function that is given a target position and invokes the forward to reverse function the appropriate # of times to reach that position from the current position and then update the current position

use readBytesUntil() to read a line of input specifying the target position

Give an overview about your project.
What do you want to do with this code?

best regards Stefan

lol, i get ya point. sorry lol
Well the sketch moves the stepper with

for (int i = 0; i < nrmoves; i++)
    {
      if(serinput[0] == 'F')   // perform full steps
      {
        if(serinput[1] == 'F') // rotate foreward
        {
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, HIGH);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, HIGH);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, LOW);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, HIGH);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
          digitalWrite(Pin7, HIGH);
          digitalWrite(Pin6, LOW);
          digitalWrite(Pin5, LOW);
          digitalWrite(Pin4, LOW);
          delay(stepdelay);
        }

So instead of using the above code to move the stepper the stepper driver does that for me i think and just need to tell it 1, which direction 2, and how many steps to move the stepper 3, weather its micro/full steps 4, and a stepdelay betweeen steps. all defined as int at the top of the sketch.
im guessing thats how the stepper coils are engaged. but as im using a stepper driver i only have two pins. step and dir. enable is set high via hardware. also. this sketch receives instructions via serial.

int  nrmoves    = 0;   // number of movements to perform
int  stepdelay  = 0;   // number of milliseconds as delay between steps/microsteps

i need to somehow make compatible code so that the serial data received actually moves the stepper correctly.

I hope iv explained myself a little better.

No you haven't wrote a single word about the real context of your project.
To ask very explicit

does your stepper motor wind up gift ribbon-band?

Does your stepper motor whirl whiskey with coca cola?
or what is your stepper motor doing in the end??
What is the final purpose?

There is a much more comfortable stepper-library called MobaTools.
I recommend using this stepper-library
With this stepper-library the required code is reduced to

myStepper.MoveTo(NumberOfsteps)

and you are done!

To expand on the posted code.
does not make use of functions => hard to read, hard to analyse
complicated serial receive-procedure

Are you forced to use exact that mechanism of serial receiving?
= you can't change the senders behaviour?
or are you able to change the senders behaviour whcih means to send a modified message
This would enable to use sending with a start and endmarker
read in the whole message and then use functions like strok to extract several parts from the message to obtain their meaning

best regards Stefan

1 Like

Hi again, I wish it whirled whiskey with cola lol really could do with a drink.

The code is an accompanying sketch that receives serial data from a windows app. The purpose.
To automatically scan 8mm cinefilm via twain using said app, NOT the sketch. All the sketch is for is to wait for the scan to finish then the windows app sends data via serial to the sketch which moves the film thru the scanner very precisely via said stepper motor and a take-up reel for already scanned film. Im unable to change the serial commands sent to the sketch so im left with editing the sketch to work with said stepper driver. Im guessing MobaTools would be combatable with my stepper driver. cos ifs its easier to use i shall give it a try. I did not write any of this code and its taken me way to long to try and decipher it. wish i was smart enough to be able to write my own code from scratch. but i have really bad dyslexia and dyspraxia even spell check struggles with what im typing sometimes.
I did do allot of reading regarding start and endmarkers using strok but not being able to change the senders made that almost impossible.

I hope iv actually given you what you need lol

all the best

Dave

P.s

this is the software im trying to use.
CineStripScanner

again, just send a target step position, not # of steps, and let the code move to the stepper to that position while always keeping track of its current position.

it decides whether it needs to move forward/reverse based on the distance, +/- to the target position.

you could always translate a time into position knowing the frames/sec rate

no need to use strtok(). maybe sscanf() consider following output and code

f
123
void setup() {
    Serial.begin (9600);

    const char s [80] = "f 123";
    char t [10];
    int  val;

    sscanf (s, "%s %d", t, & val);
    Serial.println (t);
    Serial.println (val);

}

void loop() {
}

Thank you for replying. but I really have no clue to what im doing. Was hoping someone would rewrite the code for me. my skills are in music not coding. im trying the use that stepper library MoBo cos it looks like i can just replace the stepper code with code from the library. and keep the working serial receive code.
on a side note. the code sent over serial is sent like this
" 'F'F'0'0'0'0'0'0'0'0'" Without the quotes and with a space at the start. the 1st F is either F(ull) or M(icro) the 2nd F is either F(orward) or B(ackward) and the 1st four zeros are how many step for one full revolution. so for 200 steps it would be '0'2'0'0' the next set of four zeros are for the stepdelay. a delay of 5 ms would be '0'0'0'5'

What microcontroller are you using?

Where did you get the code from that you posted in your first posting?

As a step in between, can you connect your arduino to your PC with an arduino-code that does just echo the serial commands that are received?

I would like to make really sure that the data-format is really clear.

best regards Stefan

The sketch doesnt sent code only recieves it.
Iv tried running the pc software "cinestripscanner" listening on com9 with putty. But a connection can not be made. If the pc software and the arduino serial monitor are running at the same time the pc software crashes. I posted a link 2 posts up to the website with the software. Once unzipped theres a folder with a sketch which is the one i originaly uploaded.
Thinking about it. I dont really need a stepper library.
Could i not just pulse the step pin the amount of times int nrmoves is. And set dirpin high or low when i need to change direction? That way, most of the code could stay the same.....

What microcontroller are you using?

im using a DRV8834 Low-Voltage Stepper Motor Driver

Where did you get the code from that you posted in your first posting?

https://wkurz.com/home/produkte/CineStripScanner.zip

As a step in between, can you connect your arduino to your PC with an arduino-code that does just echo the serial commands that are received?

I wouldn't know how to do that. If you could code something that would do that. i could post the code that get returned plus screenshots of the pc settings that made them. because unless you have a flatbed scanner, the pc program wont do anything.

This is the stepper-motor-driver which creates the big current for the stepper-motor. But the DRV8834 needs control-signals on his inputside

This must be some kind of microcontroller. If you haven't anyone yet I would recommend an arduino Mega 2560 because this microcontroller has a second hardware-UART that enables sending serial debug-messages on a second channel.

Do you have to save each cent or would you be able to spend another 10$ for a USB-TTL-converter?

best regards Stefan

I have an arduino uno

The ScineStripScanner-Zip-file has a better suited sketch that could be used as a base to modify
This sketch is written for the TMC26XStepper.h library

The TMC26X-drivers have a step-/dir-interface like the DRV8834
I recommend the MobaTools as the stepper-library

here is the original TMC26X-driver-sketch

// Arduino script to support the TMC26XStepper driver
// Thanks to Lawrence Cockell who has written this script
#include <SoftwareSerial.h>
#include <SPI.h>
#include <TMC26XStepper.h>
#include <Wire.h>
#include <Adafruit_MotorShield.h>
// Expected a string from CineFrameCatcher with the following layout TDssssssvvvviii
// T = type: F = fullsteps, H = halfsteps, M = microsteps (16 or 256 per fullstep)
// D = direction: F = forward,  B = backward
// ssssss = number of full, half or micro steps to be perfomed (according to type)
// vvvv = velocity of rotation in rpm (rotations per minute)
// iii = idle time in milliseconds - can be multiplied to get longer idle times
//
const int stepsPerRevolution = 400;  // set according to the used motor
                                     // for 7.5° motor :  48 steps per rotation (full step)  - not supported - not precise enough
                                     // for 1.8° motor : 200 steps for stepper initialisation
                                     // for 0.9° motor : 400 steps for stepper initialisation
                                     //
//we have a stepper motor with 400 steps per rotation, CS pin 6, dir pin 4, step pin 5 and a current of 700mA
TMC26XStepper tmc26XStepper = TMC26XStepper(400,6,4,5,700);
int  rotationSpeed1;
char termChar = '\n';
bool rotResult = false;;

void setup()
{
Serial.begin(9600);
    Serial.println("Configuring stepper driver");  // can be taken out for CineFrameCatcher, it does not care abaout that feedback
    //char constant_off_time, char blank_time, char hysteresis_start, char hysteresis_end, char hysteresis_decrement
    tmc26XStepper.setSpreadCycleChopper(2,24,8,6,0);
    tmc26XStepper.setRandomOffTime(0);
    tmc26XStepper.setMicrosteps(1);
    tmc26XStepper.setStallGuardThreshold(4,0);
    tmc26XStepper.start();
    Serial.println("config finished, starting");
    Serial.println("started");
}

void loop()
{
    while(!Serial.available());
    String incommingString = Serial.readStringUntil('\n');
    int len;
    len = incommingString.length();
    // Serial.print("incommingString ="); // for IDE to test
    // Serial.println(incommingString);   // for IDE to test  
    String incommingStr = incommingString.substring(len-15,len); // truncate to the correct length
    
  	if  (incommingStr.length() != 15)
    {
        rotResult = false;    // rotation was not successfull
    }
    else
	  {   //input has correct length
        String mode = incommingStr.substring(0,1);
        String dir = incommingStr.substring(1,2);
        String noOfSteps = incommingStr.substring(2,8);
        String rotationSpeed = incommingStr.substring(8,12);
        String sdelay = incommingStr.substring(12,15);   
        int    rotationSpeed1 = rotationSpeed.toInt();
        int    noOfSteps1 = noOfSteps.toInt();
        int    sdelay1 = sdelay.toInt();
        int    microsteps;
     
        tmc26XStepper.setSpeed(rotationSpeed1);  //adafruit v2
        rotResult = true;  // initialize rotation result to erronous 
        if (dir == "F")
        {
			tmc26XStepper.step(noOfSteps1);
		}
		else
		{
			tmc26XStepper.step(-noOfSteps1);
		}
		
        if (mode == "F")
        {
            tmc26XStepper.setMicrosteps(1);
            tmc26XStepper.step(noOfSteps1);
            for (int i = 0; i < noOfSteps1; i++)
            {
                tmc26XStepper.move();
                delay(6);
            }
        }
        if (mode == "H")
        {
            tmc26XStepper.setMicrosteps(2);
    	    for (int i = 0; i < noOfSteps1; i++)
            {
                tmc26XStepper.step(noOfSteps1);
                tmc26XStepper.move();
                delay(10);
            }
        }
        if (mode == "M")
        {   
            tmc26XStepper.setMicrosteps(256);       // 16 or 256 depending on controller board
            for (int i = 0; i < noOfSteps1; i++)
            {
                tmc26XStepper.step(noOfSteps1);
                tmc26XStepper.move();
            } 
        }        
        rotResult = true;    // rotation was successfull                   
    }
      
    if (rotResult == true)
    {
        Serial.write("1111111111");  // rotation successfull
    }
    else
    {
       Serial.write("0000000000");  // rotation failed
    }  
}   // end pf script

best regards Stefan

it would help to have the spec for the commands

consider the following to extracting command and value pairs. it expects a single letter command but could be modified to expect 2 letters, but then won't read a single letter command

void setup() {
    Serial.begin (9600);
}

void loop() {
    char  c;
    int   val;

    if (Serial.available())  {
        char buf [80];
        int  n = Serial.readBytesUntil ('\n', buf, sizeof(buf));
        buf [n] = '\0';

        if (2 == sscanf (buf, "%c%d", &c, &val))  {
            Serial.print   (c);
            Serial.print   ("-");
            Serial.println (val);
        }
    }
}

Looks like code for a unipolar motor like 28BYJ-48, what motor are you using?

1 Like

To expand some more about the code-example I have posted:

inside the the CineStripScanner.zip-file are included multiple sketches that all claim to work with the sender-software =

The sketch that works with the TMC26XStepper-diver-chip has a better approach to read in the commands using

and the code-base is much closer to the DRV8834- step/dip-interface

to give you the relevant parts of the code

void loop()
{
    while(!Serial.available());
    String incommingString = Serial.readStringUntil('\n');
        String mode = incommingStr.substring(0,1);
        String dir = incommingStr.substring(1,2);
        String noOfSteps = incommingStr.substring(2,8);
        String rotationSpeed = incommingStr.substring(8,12);
        String sdelay = incommingStr.substring(12,15);   
        int    rotationSpeed1 = rotationSpeed.toInt();
        int    noOfSteps1 = noOfSteps.toInt();
        int    sdelay1 = sdelay.toInt();
        int    microsteps;
     
        tmc26XStepper.setSpeed(rotationSpeed1);  //adafruit v2
        rotResult = true;  // initialize rotation result to erronous 
        if (dir == "F")
        {
			tmc26XStepper.step(noOfSteps1);

So why bother about the initial sketch anymore?

best regards Stefan

I wasnt sure if that sketch would work with the cinestripscanner software.
Once i get home ill take a proper look at it.
Thank you all for your help
Ill write back soon

Dave