I've created the following function:
void runMotor(int _dir, int _step, int wait){
digitalWrite(_dir, HIGH);
for (int x = 0; x < 3200; x++) {
digitalWrite(_step, HIGH);
delayMicroseconds(wait);
digitalWrite(_step, LOW);
delayMicroseconds(wait);
}
In the first line inside the function I used the value HIGH as a fixed value. I would like to know if there's a way to pass the values HIGH and LOW as a parameter in this function. Is it possible?
Or should I just create a new function to rotate my step motor to the other side?
HIGHis just an alias for the number 1.LOWis just an alias for the number 0. Anywhere you can use numbers you can useHIGHorLOWequally. You can even use them in math:HIGH + HIGH == 2. The same goes for things likeINPUT,OUTPUT,RISING,FALLING, etc. They are just aliases to numbers. – Majenko Oct 15 '16 at 11:48