Arduino on and receiving data but not working

Hello,
I am working on a few simple projects with my Arduino at the moment, but for some reason nothing is working at the moment.

I am simply trying to make a stepper motor make a full turn clockwise and another full turn on the other side.
I have two boards that both light up when connected and when the code is uploaded, the Pin 13 lights up like it should. So for now, seems like everything is working fine. However, none of the mechanical part is working. The stepper motor isn't moving at all, as if the Arduino was off. This is happening to both of my boards, I have tried using a different computer but the result was the same. Does anyone know how I could fix this please?
Thank you very much.

Here is the code I was using that was working perfectly last week.

int outPorts[] = {11, 10, 9, 8};
void setup() {
  // set pins to output
  for (int i = 0; i < 4; i++) {
    pinMode(outPorts[i], OUTPUT);
  }
}
void loop() {
  // Rotate a full turn
  moveSteps(true, 32 * 64, 2);
  delay(1000);
  // Rotate a full turn towards another direction
  moveSteps(false, 32 * 64, 2);
  delay(1000);
}
void moveSteps(bool dir, int steps, byte ms) {
  for (int i = 0; i < steps; i++) {
    moveOneStep(dir); // Rotate a step
    delay(ms);        // Control the speed
  }
}
void moveOneStep(bool dir) {
  // Define a variable, use four low bit to indicate the state of port
  static byte out = 0x01;
  // Decide the shift direction according to the rotation direction
  if (dir) {  // ring shift left
    out != 0x08 ? out = out << 1 : out = 0x01;
  }
  else {      // ring shift right
    out != 0x01 ? out = out >> 1 : out = 0x08;
  }
  // Output singal to each port
  for (int i = 0; i < 4; i++) {
    digitalWrite(outPorts[i], (out & (0x01 << i)) ? HIGH : LOW);
  }
}

This is the sketch I am using

Your Arduino is not a power supply. What are the specs of the stepper that you use; you might need an external power supply for the steppers.

Double check wiring.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the IDE 1.x category.

Have you tried it this week? Did you modify the sketch? Did you make any other changes since last week?

I did. I didn't change any of the code or wiring or sketch. It is the exact same thing...

That's what I thought but I had the exact same wiring, code, power source last week and it did work. I had 3 people check it as well in case I missed something but they couldn't find anything wrong on code or wiring.

Damage can be gradual, from what I read. So maybe last week it was on the verge of failing and now it has.

Measure the voltage at the 5V pin. And try with an external 5V anyway.

You forgot to answer this

Oh no... I just checked they are 12V. In the rush of it all I forgot to check. Do you reckon that damaged the board? Even though it still turns on and Pin13 blinks when uploading code?
That's what I used https://www.amazon.co.uk/gp/product/B07Y9PT7VJ/ref=ppx_yo_dt_b_asin_title_o08_s02?ie=UTF8&psc=1

It says it can run 5V though?

You haven't posted enough hardware details to answer those questions. The one Fritzing diagram you posted, has a lot of unlabelled devices, and doesn't show power connections at all.

I'm using a Arduino Uno, a ULN2003 stepper motor driver, this stepper motor (https://www.amazon.co.uk/gp/product/B07Y9PT7VJ/ref=ppx_yo_dt_b_asin_title_o08_s02?ie=UTF8&psc=1) and I'm powering the board through my computer with a USB cable. That's all there is and I have connected the wires exactly like they are in the diagram. Again, it worked very well last time but not anymore, and even with other projects I encounter the same problem: Arduino is on, seems to receive data, but nothing happens. I have had 3 people check with me as well but none of them knew what to tell me

Yes, but the diagram is incomplete.

I'm not sure what you mean. This is what I was using last week and it worked. I am just powering the board from my computer and that's how it was working before. I didn't use anything else so I'm confused on how this is incomplete as it's all I've used.
Also this particular issue is not the problem I think, as any other simple project doesn't seem to be working either

So, you're saying, even the Blink sketch doesn't work when you upload it?

Probably.

Mmh. I just uploaded the code for blink and it does work...

You said this, that's why I mentioned Blink, because it is a simple project. So you have to be more specific.

I think I know what was wrong. The blink didn't work when I was working in the studio. I tested blink again yesterday at home and the only thing that was different was the cable. So I definitely think it's the cable (from computer to arduino) that was the issue. I just wanted to post this last message in case someone had the same issue !

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