Need somebody familiar with the ESP8266 NodeMCU and the esp8266WiFi.h library
I need to know if the WiFi.RSSI() within the WiFi library temporarily cuts power to the GPIO pins. Or if anybody has also had interference between the wifi.h library and the accelstepper.h library.
I did read in the DM332T's user manual that there is an automatic idle current reduction.
Basically, when moving the motor stops moving and I tell it to pull a RSSI value, the motor drops position (due to the load and not being able to hold it up all of a sudden - as if I temporarily lost power). But this only happens when using the esp8266WiFi.h library. I have run similar code and have the motor move a specific number of steps and hold there for hours (not literal hours but indeed for a very long time).
Code I'm using to test the wifi.h and accelstepper.h integration:
#include <Wire.h>
#include <ESP8266WiFi.h> //program to display RSSI of WiFi signal on serial monitor
#include <AccelStepper.h>
//SSID of your network
char ssid[] = "WiFiTracker";
//password of your WPA Network
char pass[] = "";
const int elBroadScanSteps = -711; // 20 deg step increments with dipswitch set to 12800
const int elMaxSpd = 250;
const int elMaxAccel = 12;
const int elHomePosition = -1600; // ~45 deg;
#define pul2Pin 12 //GPIO12 = ESP Pin D6
#define dir2Pin 14 //GPIO14 = ESP Pin D5
// initialize the stepper library
//(Normally you could use the syntax of: azStepper(1, pulpin, dirpin), but for some reason the esp is super picky and only likes this syntax)
AccelStepper elStepper(AccelStepper::DRIVER, pul2Pin, dir2Pin);
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println();
Serial.println("ESP8266 WiFi Signal Strength Checker");
WiFi.begin(ssid, pass);
Serial.println();
Serial.print("Connecting...");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
// if you are connected, print out info about the connection:
Serial.print("\nConnected to: ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
Serial.println("");
delay(1000);
// set the speed and acceleration of azimuth stepper
elStepper.setMaxSpeed(elMaxSpd);
elStepper.setAcceleration(elMaxAccel);
elStepper.runToNewPosition(elHomePosition); //move antenna to up/home position (to 90 deg relative to column)
// pulls the current RSSI value during the program setup stage - could be used to kick off comparison functions
elStepper.run();
static long currentRSSI = WiFi.RSSI();
Serial.print("Current RSSI value is: ");
Serial.println(currentRSSI);
delay(3000);
}
void loop() {
// put your main code here, to run repeatedly:
elStepper.run();
// print the received signal strength:
long rssi = WiFi.RSSI(); //rssi stands for received signal strengh indicator - variable we want to maximize
Serial.print("RSSI: ");
Serial.print(rssi);
Serial.println (" dBm");
delay(1000);
}