Hi
i try to control a curtain with ac motor. I use NodeMCU 12E and AC Dimmer with Blynk
/*
This is the code for AC Dimmer using Arduino Board.
To watch it's full tutorial video, head on to my YouTube Channel
http://www.youtube.com/techiesms
*/
#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_TEMPLATE_ID "TMPL2sBtHPSFl"
#define BLYNK_TEMPLATE_NAME "acDimmer"
#define BLYNK_AUTH_TOKEN "duXuu137r5_aEaiLOiWhzbUL7VrOw3NH"
#define triacPulse 5 //D1
#define ZVC 4 //D2
int Slider_Value;
int dimming;
int x = 0;
char auth[] = "duXuu137r5_aEaiLOiWhzbUL7VrOw3NH"; // You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon) in the Blynk app or check your email for auth token.
//char ssid[] = "ArduinoCS"; // Your WiFi credentials.
//char pass[] = "02151627"; // Set password to "" for open networks.
char ssid[] = "Helals"; // Your WiFi credentials.
char pass[] = "Moneim&46&Atiat"; // Set password to "" for open networks.
BLYNK_WRITE(V1) // function to assign value to variable Slider_Value whenever slider changes position
{
Slider_Value = param.asInt(); // assigning incoming value from pin V1 to a variable
}
void setup()
{
pinMode(ZVC, INPUT_PULLUP);
//digitalWrite(2, INPUT_PULLUP); // pull up
pinMode(triacPulse, OUTPUT);
Serial.begin(115200);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 8080);
Blynk.begin(auth, ssid, pass);
attachInterrupt(digitalPinToInterrupt(ZVC), acon, FALLING); // attach Interrupt at PIN2
}
void loop()
{
Blynk.run();
// When the switch is closed
dimming = map(Slider_Value, 0, 100, 7200, 200); //0.2ms 7.2 ms
}
void acon()
{
// Serial.println("REad");
delayMicroseconds(dimming); // read AD0
digitalWrite(triacPulse, HIGH);
delayMicroseconds(50); //delay 50 uSec on output pulse to turn on triac
digitalWrite(triacPulse, LOW);
// Serial.println(digitalRead(triacPulse));
}
the esp8266 connects to the blynk app but i get the below results
���e�'�{��n<�$�d`c��|r�l�g��g�d`��;�d�d��[79] Connecting to Helals
[7413] Connected to WiFi
[7413] IP: 192.168.1.8
[7413]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v1.3.2 on ESP8266
#StandWithUkraine https://bit.ly/swua
[7423] Connecting to blynk.cloud:80
[7698] Ready (ping: 131ms).
ISR not in IRAM!
User exception (panic/abort/assert)
>>>stack>>>
ctx: cont
sp: 3fffff80 end: 3fffffd0 offset: 0010
3fffff90: 402078fc 0801a8c0 00000004 40204de1
3fffffa0: feefeffe feefeffe feefeffe 3ffeed90
3fffffb0: 3fffdad0 00000000 3ffeed64 40204420
3fffffc0: feefeffe feefeffe 3fffdab0 40100f91
<<<stack<<<
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v000469b0
any help to fix this error