Trying to use digital interrupt to trigger Stepper motor rotation

Right now a 3.3V digital HIGH on pin 3 of an Arduino Pro Mini is not working.
Thanks for any advice!

CoffeePress.ino (2.63 KB)

On what grounds do you base this observation?

/*
   BYJ48 Stepper motor code
   Connect :
   IN1 >> D8
   IN2 >> D9
   IN3 >> D10
   IN4 >> D11
   VCC ... 5V Prefer to use external 5V Source
   Gnd
   written By :Mohannad Rawashdeh
  http://www.instructables.com/member/Mohannad+Rawashdeh/
     28/9/2013


     And LED interrupt based on https://www.arduino.cc/en/Reference/AttachInterrupt
  */

#define IN1  8
#define IN2  9
#define IN3  10
#define IN4  11
int Steps = 0;
boolean Direction = true;// gre
unsigned long last_time;
unsigned long currentMillis ;
int steps_left=4095;
long time;
const byte pressButton;
const byte IOTpressed = 3;
volatile byte state = LOW;

void setup() {
 pinMode(IN1, OUTPUT); 
  pinMode(IN2, OUTPUT); 
   pinMode(IN3, OUTPUT); 
    pinMode(IN4, OUTPUT); 
 pinMode(IOTpressed, INPUT_PULLUP);
 attachInterrupt(digitalPinToInterrupt(IOTpressed), onOff, RISING);
}

void loop() {
  digitalWrite(pressButton, state);
  
  if (pressButton==HIGH) {
    while(steps_left>0){
  currentMillis = micros();
  if(currentMillis-last_time>=1000){
  press(1); 
  time=time+micros()-last_time;
  last_time=micros();
  steps_left--;
   }
  }
  Direction=!Direction;
  steps_left=4095;
  state = !state;
}
}
void onOff() {
  state = !state;
}

void press(int xw){
  for (int x=0;x<xw;x++){
switch(Steps){
   case 0:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, HIGH);
   break; 
   case 1:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, HIGH);
   break; 
   case 2:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, LOW);
   break; 
   case 3:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, LOW);
   break; 
   case 4:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
   case 5:
     digitalWrite(IN1, HIGH); 
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
     case 6:
     digitalWrite(IN1, HIGH); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
   case 7:
     digitalWrite(IN1, HIGH); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, HIGH);
   break; 
   default:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
}
SetDirection();
}
} 
void SetDirection(){
if(Direction==1){ Steps++;}
if(Direction==0){ Steps--; }
if(Steps>7){Steps=0;}
if(Steps<0){Steps=7; }
}

AWOL:
On what grounds do you base this observation?

Clever!
I connected Vcc of the Arduino to pin 3, while Ground and Pin 10 were on my tongue.
I felt no tingling.

const byte pressButton;
...
void loop() 
{
  digitalWrite(pressButton, state);
  
  if (pressButton==HIGH) {

What makes you think zero will ever equal one?

attachInterrupt(digitalPinToInterrupt(IOTpressed), onOff, RISING);
...
void onOff() {
  state = !state;
} {

Looks like a logic error to me.

const byte pressButton; << results in pressButton = 0

digitalWrite(pressButton, state); << writes a 0 or 1 to pin D0

if (pressButton==HIGH) { << nothing ever makes pressButton HIGH, so this is always false


Switched IOTpressed Pin from 3 to 1 and still no Stepper pulses after pulled HIGH.

Did you make the code corrections pointed-out?

CrossRoads:
Looks like a logic error to me.

const byte pressButton; << results in pressButton = 0

digitalWrite(pressButton, state); << writes a 0 or 1 to pin D0

if (pressButton==HIGH) { << nothing ever makes pressButton HIGH, so this is always false

The Interrupt pin calls

void onOff()

and that changes state which

digitalWrite(pressButton, state);

BTW awesome link for BB codes http://www.dailywritingtips.com/forum/misc.php?do=bbcode

Still having to wait 5 minutes between posts. "You have exceeded the number of posts you can make in a 5 minutes period. Please try again later."

Have you fixed the problem pointed-out in replies #3 and #5?
(The five minute pause is to discourage drive-by spammings. It doesn't seem so long if you use the time to review your code and the replies people have posted)