so i have 4 leds. i have a second arduino pulsing every second. the second arduino is fed straight wire into A3. i do a digital read on A3 and get a value i then use in a digital write.
the val POSA starts at 6 and needs to go up to 9, then repeat to 6.
i use a loop and i get theh led to mirror the second arduino pulsing. blink blink.
now when i add the code
posA ++;
or
posA = posA + 1;
the program blinks the first led on pin 6, then does nothing.
please help me.
int A = 6;
int B = 7;
int C = 8;
int D = 9;
int stepA = A3;
int dirA = A2;
int stepB = A1;
int dirB = A0;
int valstepA = 0;
int valdirA = 0;
int posA = 6;
void setup() {
// put your setup code here, to run once:
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
pinMode(D, OUTPUT);
pinMode(stepA, INPUT);
pinMode(dirA, INPUT);
pinMode(stepB, INPUT);
pinMode(dirB, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
do{
valdirA = digitalRead(dirA);
valstepA = digitalRead(stepA);
digitalWrite(posA, valstepA);
} while (valstepA == HIGH);
posA ++;
}