Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define przek 0
- void pompasetup() {
- pinMode(przek, OUTPUT); //LED na module
- digitalWrite(przek, HIGH);
- }
- int t_on = 10;
- int t_off = 10;
- int stan_przek = 1; //0 włączony 1 wyłączony 2 regulowany czas załączenia
- void speed_led(){
- if (stan_przek == 1) akcja.updateInterval(2, 2000);
- if (stan_przek == 0) akcja.updateInterval(2, 1000);
- if (stan_przek == 2) akcja.updateInterval(2, 500);
- }
- void wys_t() {
- Blynk.virtualWrite(V2, t_on);
- Blynk.virtualWrite(V3, t_off);
- }
- int on_off = 0; // stan włącznika głównego
- int on_off_t = 0; // stan włącznika regulacji czasu
- BLYNK_WRITE(V10) {
- if (param.asInt()) on_off = 1;
- else on_off = 0;
- if (on_off) {
- if (on_off_t) stan_przek = 2;
- else stan_przek = 0;
- } else stan_przek = 1;
- if (param.asInt()) digitalWrite(przek, LOW);
- else digitalWrite(przek, HIGH);
- Blynk.virtualWrite(V1, stan_przek);
- wys_t();
- speed_led();
- }
- int t_on_mem = 10;
- int t_off_mem = 10;
- BLYNK_WRITE(V11) {
- on_off_t = (param.asInt());
- if (on_off_t) t_on = t_on_mem;
- // else t_on = 0;
- if (on_off_t) t_off = t_off_mem;
- // else t_off = 0;
- if (on_off_t)
- ;
- else stan_przek = !on_off;
- Blynk.virtualWrite(V1, stan_przek);
- wys_t();
- }
- BLYNK_WRITE(V12) {
- t_on_mem = (param.asInt());
- t_on = t_on_mem;
- wys_t();
- }
- BLYNK_WRITE(V13) {
- t_off_mem = (param.asInt());
- t_off = t_off_mem;
- wys_t();
- }
- void czas_timer() {
- if (stan_przek > 1) {
- if (stan_przek == 2) {
- t_on = t_on - 1;
- if (t_on < 1) {
- t_off = t_off_mem + 1;
- digitalWrite(przek, HIGH);
- stan_przek = 3;
- }
- }
- if (stan_przek == 3) {
- t_off = t_off - 1;
- if (t_off < 1) {
- t_on = t_on_mem;
- digitalWrite(przek, LOW);
- stan_przek = 2;
- }
- }
- }
- wys_t();
- }
Advertisement
Add Comment
Please, Sign In to add comment