So i'm currently coding a little device that rotates a step motor round one 8th of a full revolution every time a button is pushed. the motor is attached to a question reel with 8 questions on it, each one is viewable through a little window covering the reel after each button press. the thing im concerned about is that if even one of the question sections is slightly larger or smaller than the others, it will cause the question to become misaligned with the window after a certain number of run throughs.
in order to combat this I want to have a back up code that simply rotates the stepper while the button is held down. this will allow me to manually reset the reel to its proper positioning should the questions become misaligned. im not achieving this however, and was hoping someone may be able to detect where the issues are in my code?
#include <Stepper.h> #define STEPS 2048 Stepper myStepper(STEPS, 8, 10, 9, 11); const int buttonPinBlue = 6; void setup() { myStepper.setSpeed(5); } void stepp() { myStepper.step(1); pinMode(buttonPinBlue, INPUT); } void loop() { if (buttonPinBlue == HIGH) { Serial.print("pin is high"); stepp(); } } also just as a side note, the stepper runs fine using the 'define steps' value and the speed that I've set here, the issue appears to be that the button press is not being detected