Sorry for the mistake, this code was obviously only for testing if the Pins were delivering 5v.
I used a more complex sketch that receives commands from a software (Max) to test the motor themself.
// www.alessandroperini.com
// DIR = HIGH ----> HEADING RIGHT
// DIR = LOW ----> HEADING LEFT
const byte numChars = 72;
char receivedChars[numChars];
byte m1on;
byte m1sp;
byte m2on;
byte m2sp;
byte m3on;
byte m3sp;
byte globalSpeed;
boolean newData = false;
const int step1 =6; // PINs DA CAMBIARE PER PASSAGGIO A NANO
const int dir1 = 7;
const int step2 = 2;
const int dir2 = 3;
const int step3 = 5;
const int dir3 = 4;
const int en1 = 2; // Enable
const int en2 = 8; // Enable
const int en3 = 11; // Enable
const int lowestMd = 3; // minimum microdelay
void setup() {
pinMode(step1, OUTPUT);
pinMode(dir1, OUTPUT);
pinMode(step2, OUTPUT);
pinMode(dir2, OUTPUT);
pinMode(step3, OUTPUT);
pinMode(dir3, OUTPUT);
pinMode(en1, OUTPUT);
pinMode(en2, OUTPUT);
pinMode(en3, OUTPUT);
digitalWrite(step1, LOW);
digitalWrite(step2, LOW);
digitalWrite(step3, LOW);
digitalWrite(en1, LOW);
digitalWrite(en2, LOW);
digitalWrite(en3, LOW);
Serial.begin(38400);
}
void loop() {
recvWithStartEndMarkers();
writeToMotors();
showNewData();
}
////////////////////////////////////////////////////////////////////////////////////////////
void recvWithStartEndMarkers() { // RECEIVE THE BYTES, USING START AND END MARKERS
static boolean recvInProgress = false;
static byte ndx = 0;
byte startMarker = 255;
byte endMarker = 250;
byte rc;
//
while (Serial.available() > 0 && newData == false) {
rc = Serial.read();
if (recvInProgress == true) {
if (rc != endMarker) {
receivedChars[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;
}
}
else {
receivedChars[ndx] = '\0'; // terminate the string
recvInProgress = false;
ndx = 0;
newData = true;
}
}
else if (rc == startMarker) {
recvInProgress = true;
}
}
}
void showNewData() {
if (newData == true) {
m1on = (byte)receivedChars[0];
m1sp = (byte)receivedChars[1];
m2on = (byte)receivedChars[2];
m2sp = (byte)receivedChars[3];
m3on = (byte)receivedChars[4];
m3sp = (byte)receivedChars[5];
globalSpeed = (byte)receivedChars[6];
Serial.print(" m1on ");
Serial.print(m1on);
Serial.print("\t");
Serial.print(" m1sp ");
Serial.print(m1sp);
Serial.print("\t");
Serial.print(" m2on ");
Serial.print(m2on);
Serial.print("\t");
Serial.print(" m2sp ");
Serial.print(m2sp);
Serial.print("\t");
Serial.print(" m3on ");
Serial.print(m3on);
Serial.print("\t");
Serial.print(" m3sp ");
Serial.print(m3sp);
Serial.print("\t");
Serial.print(" globalSpeed ");
Serial.println(globalSpeed);
newData = false;
}
}
void writeToMotors() {
/// CHECK IF STEPPING ///
if (m1on == 0) {
digitalWrite(step1, LOW);
digitalWrite(en1, HIGH);
} else {
digitalWrite(step1, HIGH);
digitalWrite(en1, LOW);
}
if (m2on == 0) {
digitalWrite(step2, LOW);
digitalWrite(en2, HIGH);
} else {
digitalWrite(step2, HIGH);
digitalWrite(en2, LOW);
}
if (m3on == 0) {
digitalWrite(step3, LOW);
digitalWrite(en3, HIGH);
} else {
digitalWrite(step3, HIGH);
digitalWrite(en3, LOW);
}
/// DIR ///
if (m1sp >= 64) {
digitalWrite(dir1, HIGH);
}
else {
digitalWrite(dir1, LOW);
}
if (m2sp >= 64) {
digitalWrite(dir2, HIGH);
}
else {
digitalWrite(dir2, LOW);
}
if (m3sp >= 64) {
digitalWrite(dir3, HIGH);
}
else {
digitalWrite(dir3, LOW);
}
int scaledSpeed = (lowestMd + 127 * 25) - globalSpeed * 25;
delayMicroseconds(scaledSpeed);
digitalWrite(step1, LOW);
digitalWrite(step2, LOW);
digitalWrite(step3, LOW);
delayMicroseconds(scaledSpeed);
}
/*
CONTROLS 3 TB660
*/
It's derived from this older project of mine.
Sorry for the confusion. This code up here works on the UNO and not on the Nano Every.