Hi there,
I have come up with the same problem with my servo only moving through 90degrees. I have attempted to adjust the Pulse widths as described by Abhijeet but it still doesnt appear to be working. I am using a nodeMCU ESP8266 with Blynk 2.0.
Datastreams - I have tried a few different settings but with no joy, they are currently set as integer, min = 0 and max = 180.
Not sure if I have updated the settings correctly or if anyone has any other ideas?
Many thanks
Dave
Code is
#define BLYNK_TEMPLATE_ID "REDACTED"
#define BLYNK_TEMPLATE_NAME "ServoControl"
#define BLYNK_AUTH_TOKEN "REDACTED"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include<Servo.h>
Servo servo1;
#define DEFAULT_MIN_PULSE_WIDTH 500
#define DEFAULT_MAX_PULSE_WIDTH 2500
#define DEFAULT_NEUTRAL_PULSE_WIDTH 1500
#define REFRESH_INTERVAL 20000
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "BT-SKATMF";
char pass[] = "K3vrQCyxMFcuXg";
BLYNK_WRITE(V0)
{
int s0 = param.asInt();
servo1.write(s0);
Blynk.virtualWrite(V1, s0);
}
void setup()
{
Serial.begin(9600);
servo1.attach(D2);
//servo1.write(0);
Blynk.begin(auth, ssid, pass);//Splash screen delay
//delay(2000);
}
void loop()
{
Blynk.run();
}
And then the output from the console window is as follows…
C:\Users\dh526\AppData\Local\Temp\.arduinoIDE-unsaved2023111-1980-1e6e1yb.mr0zl\sketch_feb11d\sketch_feb11d.ino:12: warning: "DEFAULT_MIN_PULSE_WIDTH" redefined
12 | #define DEFAULT_MIN_PULSE_WIDTH 500
|
In file included from C:\Users\dh526\AppData\Local\Temp\.arduinoIDE-unsaved2023111-1980-1e6e1yb.mr0zl\sketch_feb11d\sketch_feb11d.ino:9:
C:\Users\dh526\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\Servo\src/Servo.h:54: note: this is the location of the previous definition
54 | #define DEFAULT_MIN_PULSE_WIDTH 1000 // uncalibrated default, the shortest duty cycle sent to a servo
|
C:\Users\dh526\AppData\Local\Temp\.arduinoIDE-unsaved2023111-1980-1e6e1yb.mr0zl\sketch_feb11d\sketch_feb11d.ino:13: warning: "DEFAULT_MAX_PULSE_WIDTH" redefined
13 | #define DEFAULT_MAX_PULSE_WIDTH 2500
|
In file included from C:\Users\dh526\AppData\Local\Temp\.arduinoIDE-unsaved2023111-1980-1e6e1yb.mr0zl\sketch_feb11d\sketch_feb11d.ino:9:
C:\Users\dh526\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\Servo\src/Servo.h:55: note: this is the location of the previous definition
55 | #define DEFAULT_MAX_PULSE_WIDTH 2000 // uncalibrated default, the longest duty cycle sent to a servo
|
. Variables and constants in RAM (global, static), used 29984 / 80192 bytes (37%)
║ SEGMENT BYTES DESCRIPTION
╠══ DATA 1564 initialized variables
╠══ RODATA 2492 constants
╚══ BSS 25928 zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 61247 / 65536 bytes (93%)
║ SEGMENT BYTES DESCRIPTION
╠══ ICACHE 32768 reserved space for flash instruction cache
╚══ IRAM 28479 code in IRAM
. Code in flash (default, ICACHE_FLASH_ATTR), used 252308 / 1048576 bytes (24%)
║ SEGMENT BYTES DESCRIPTION
╚══ IROM 252308 code in flash
esptool.py v3.0
Serial port COM5
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: b4:e6:2d:49:55:a7
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 288992 bytes to 211629...
Writing at 0x00000000... (7 %)
Writing at 0x00004000... (15 %)
Writing at 0x00008000... (23 %)
Writing at 0x0000c000... (30 %)
Writing at 0x00010000... (38 %)
Writing at 0x00014000... (46 %)
Writing at 0x00018000... (53 %)
Writing at 0x0001c000... (61 %)
Writing at 0x00020000... (69 %)
Writing at 0x00024000... (76 %)
Writing at 0x00028000... (84 %)
Writing at 0x0002c000... (92 %)
Writing at 0x00030000... (100 %)
Wrote 288992 bytes (211629 compressed) at 0x00000000 in 18.7 seconds (effective 123.3 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...