I will check that threads.
Wifi is not necessary to use, thats correct. But when ESP have WIFI function....
Anyway, I will ask you if you know how to set up stepper be controlled over PCF8574 i2c?
I had some code which was working on control stepper with regular connection to esp.
When I put PCF8574 between, I am confuse how control over is working. (my pcf if on 0x20 address).
#include <PCF8574.h>
#include <AccelStepper.h>
const int stepsPerRevolution = 2048; // change this to fit the number of steps per revolution
// ULN2003 Motor Driver Pins before:
/*#define IN1 14
#define IN2 12
#define IN3 13
#define IN4 15*/
#define IN1 P0
#define IN2 P1
#define IN3 P2
#define IN4 P3
// Set the i2c HEX address
PCF8574 pcf8574(0x20);
// initialize the stepper library
AccelStepper stepper(AccelStepper::HALF4WIRE, IN1, IN3, IN2, IN4);
void setup() {
// initialize the serial port
Serial.begin(115200);
// Set the pinModes
pcf8574.pinMode(P0, OUTPUT);
pcf8574.pinMode(P1, OUTPUT);
pcf8574.pinMode(P2, OUTPUT);
pcf8574.pinMode(P3, OUTPUT);
pcf8574.begin();
// set the speed and acceleration
stepper.setMaxSpeed(700);//500
stepper.setAcceleration(100);
// set target position
stepper.moveTo(4*stepsPerRevolution); //1*
}
void loop() {
// check current stepper motor position to invert direction
if (stepper.distanceToGo() == 0){
stepper.moveTo(-stepper.currentPosition());
Serial.println("Changing direction");
}
// move the stepper motor (one step at a time)
stepper.run();
}
But as you probably expect, control of stepper fail. Lights on driver of stepper shine but thats all.