Hi, i'm using this script for controlling my cnc Spindle.
I have the next problem, when working arround 30min the arduino gose to System Ready and stops the spindle until i reset the arduino again.
Can some one please look at the script and see if there is a bug that stops the program
I suspect your problem (other than generally dubious coding techniques) is using inappropriate datatypes, resulting in th
I don't know what "long int" turns into... but you probably want it to be an unsigned long, likewise MaxRunTime should also probably be an unsigned long.
An int datatype can only store values from -32768 to 32767, whole numbers only - for larger numbers you need to use long (-2.1 bil to 2.1 bil), or unsigned long (0 to 4.2 bil). If you're ever storing numbers derived from millis() in a variable, it should probably be unsigned long, since that's what millis() returns, and if you stuff it into a different variable, you'll get behavior you probably don't expect.
Also, this applies to integer constants in your code. To specify a number is a long or unsigned long, put L or UL after it (ex, 100000UL not 100000 - otherwise the compiler treats it as an int).
DrAzzy:
Also, this applies to integer constants in your code. To specify a number is a long or unsigned long, put L or UL after it (ex, 100000UL not 100000 - otherwise the compiler treats it as an int).
This is incorrect. The type of a decimal integer constant without any suffix is int, long int or long long int depending on its value.