3

Try using digitalRead() for button presses. Chances are your buttons, especially when on a breadboard, don't return exactly 0 for analogRead(). IMHO, simple On-Off switches should always connect your pin to either Vcc or GND, with either the internal pullup turned on (if connected to GND), or an external pulldown resistor in place. To debug this, you might ...


2

I would suggest finding sensors that work on an I2C bus. This way all the sensors are only using two pins for data. That will free up other outputs for motors, heaters that will probably be on relays or other drivers that need a single or multiple pins for each devices. As you start to plan it out, if you do run out of pins on a arduino uno, look at the ...


2

First, you are creating/destroying the AccelStepper stepper1() object at every call. This is not right, as the library can no longer keep track of the stepper position and state. The stepper object should be created in the global scope (that is, outside of setup() or loop()). Second, you can call stepper1.setEnablePin(enPin) and stepper1.setPinsInverted(...


2

Try manually resetting the board: Before uploading, run Verify. Hold the reset button and click Upload. Release the reset button. If that worked, your board's reset isn't fried, it just isn't receiving a reset via the serial cable. If it failed, either part of the board or MCU may be damaged; something attached to the board may be inhibiting the reset ...


2

Hi here it the reference to the library functions that are available in accelstepper library. Go through the link, it will provide you the issues with your code and example for your application like @smajli said steps more than 1000 is unreliabe, here you can see setSpeed(float) function where setting negative or positive sign selects the direction and ...


2

Per the documentation of the AccelStepper’s runSpeed() method: You must call this as frequently as possible, but at least once per step interval, It appears the AccelStepper library is not compatible with blocking code. Not a big deal, blocking code is almost always bad practice anyway. However, Serial.readStringUntil() is a blocking function: it will ...


2

I had a similar issue once before. It actually matters a lot to properly ramp up your stepper motor. Especially under load if you ramp up too steep you can loose steps. Since you are already using the arduino environment I suggest you could use the AccelStepper library. I lets you set the acceleration and max. speed parameters nicely and uses a properly ...


1

Your best option would be: To have a DC motor with a reduction box so that it spins at lower speeds (Lets say 300 rpm) and have an encoder to count the steps. Either put the encoder before the reduction box (here it can be used a low resolution encoder, like 16 positions) or after the reduction (here you would like a more precise one, such as those 1024 ...


1

For those who missed the comments, what I made a mistake in, as @JRobert pointed is that I was suppose to have connected the stepper motor to a separate power supply as the Arduino was not capable of so much resources. I also altered the code as I think I had gotten the steps-per-revolution wrong which is needed in the Stepper function in the Arduino Code. ...


1

On Arduino Uno (and most basic Arduinos), the 'L' LED is operated by whatever code is on the Arduino. RX and TX flicker whenever the Arduino is sending data to the PC (TX) or is receiving data from the PC (RX). If you have never re-programmed your Arduino, it is running whatever code was in it when it was shipped to you. It sounds like your Arduino has a ...


1

With these requirements you can use most available Arduinos. The WS2812 LED strips need 1 pin per strip (or 1 pin in total, if you daisy-chain all the strips, meaning connecting the data lines of them to one big strip). How many pins you need for the stepper motor depends on the type of motor and what type of driver you have for it. Most stepper drivers need ...


1

... why the break command raises and error? Because you are using it wrong! break will end a loop, and is used in the switch...case statements. Read the documentation for break if you need to know more I have fixed it, the delay at the end fixes it for some reason. I don’t know why though. You haven't really fixed it if you don't know why. It seems ...


1

The product page you gave has a link to the DRV8825 datasheet. Reading this, it is clear that the enable pin(s) comlpetely disable the H-Bridge that drives the motor coils. This is low power mode. It'd doesn't mean low, but non-zero holding current. The driver only supports enabled and disabled. If your steppers are getting hot, perhaps the current being ...


1

Maybe for the second function you want something like this: void stepper_run_cw(void){ stepper_step_cw(1,0,0,0,1); stepper_step_cw(1,1,0,0,1); stepper_step_cw(0,1,0,0,1); stepper_step_cw(0,1,1,0,1); stepper_step_cw(0,0,1,0,1); stepper_step_cw(0,0,1,1,1); stepper_step_cw(0,0,0,1,1); stepper_step_cw(1,0,0,1,1); } void stepper_step_cw(...


1

Like @chris! suggested, you could include two Stepper variables. So in the line where you were initializing the variable, you could instead have: Stepper steppermotor1(stepsPerRevolution, 8, 10, 9, 11); Stepper steppermotor2(stepsPerRevolution, 4, 5, 6, 7); and then continue on with the code for speed, rotation and so on for each motor.


1

Instead of delaying between pulses, loop around the main loop() function as fast as possible constantly checking the time to see if we should pulse the motor. This means that computations can occur in the loop (so long as they are reasonably fast). To implement this, the micros() function can be used to get an unsigned long representing the microseconds ...


1

Also working on making a compass for flight simulator. Hopefully the following code will help answer the question. This is a working code that I have tested using serial monitor... Note: For Flight Sim use, I did find that to get enough speed and smooth movement for the X27-168 gauge motor you need to use a stepper driver with microstepping rather than ...


1

Two options (for starters): Use the move() class rather than the moveTo() class. This will allow you to do relative moves rather than absolute. Use setCurrentPosition() (which sets the current position to zero) followed by moveTo() with a destination which is newPos - prevPos. For either to work you will need to keep track of the current position of the ...


1

Fortunately, the timer for PWM on both pins 9 and 10 on the Arduino Mega (but not necessarily other boards) is timer 2, so changing the PWM frequency of one will change the PWM frequency of the other. You should also check that changing the the timer frequency does not effect any other libraries (eg Servo, from memory typically uses timer 2). The frequency ...


1

You need to be using the adjusted delay for both the high and the low part of the signal. Also, what happens when the variable "increment" is larger than 2000? Nothing good, for certain. I'd personally like to be able to delay by a negative number and undo some things that are already done, but I don't think yoz can turn back time using an Arduino.


Only top voted, non community-wiki answers of a minimum length are eligible