-
-
Save chepecarlos/6cc5d68ff140c36f79a9fd31c6864725 to your computer and use it in GitHub Desktop.
RED MOST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BLYNK_PRINT Serial | |
#include <WiFi.h> | |
#include <WiFiClient.h> | |
#include <BlynkSimpleEsp32.h> | |
// You should get Auth Token in the Blynk App. | |
// Go to the Project Settings (nut icon | |
char auth[] = "49bfe35f825542cdbc4948a73415b585"; | |
// Your WiFi credentials. | |
// Set password to "" for open networks. | |
char ssid[] = "AndroidA"; //TURBONETT_2964B8 | |
char pass[] = "jmei9489";//e8b346fbb8 | |
//sistema de Luces Altas | |
int ledlucesa = 21; //pin del led | |
int botonlucesa = 36; //pin del boton del led | |
boolean estadoalta = false; //estado de led o activacion | |
//Sistema de luces Bajas | |
int ledlucesb = 22; //pin del led | |
int botonlucesb = 37; //pin del boton del led | |
boolean estadobaja = false; //estado de led o activacion | |
//Sistema de Cricos | |
int ledcricos = 19; //pin del led | |
int botoncricos = 38; //pin del boton del led | |
boolean estadocricos = false; //estado de led o activacion | |
//Sistema de Audio | |
int ledcd = 23; //pin del led | |
int botoncd = 39; //pin del boton del led | |
boolean estadocd = false; //estado de led o activacion | |
//Sistem Elevalunas subir. | |
int ledvidrios = 18; //pin del led | |
int botonvidrios = 33; //pin del boton del led | |
boolean estadovidrios = false; //estado de led o activacion | |
//Sistem Elevalunas bajar. | |
int ledvidrios2 = 2; //pin del led | |
int botonvidrios2 = 14; //pin del boton del led | |
boolean estadovidrios2 = false; //estado de led o activacion | |
void setup() | |
{ | |
// Debug console | |
Serial.begin(115200); | |
//inicializar variable | |
Serial.println("Iniciando wifi ...."); | |
Blynk.begin(auth, ssid, pass); | |
Serial.println("Wifi iniciado y Blynk conectado"); | |
pinMode (ledlucesa, OUTPUT); | |
pinMode (botonlucesa, INPUT); | |
digitalWrite (ledlucesa, 0); | |
//inicializar variable | |
pinMode (ledlucesb, OUTPUT); | |
pinMode (botonlucesb, INPUT); | |
digitalWrite (ledlucesb, 0); | |
//inicializar variable | |
pinMode (ledcricos, OUTPUT); | |
pinMode (botoncricos, INPUT); | |
digitalWrite (ledcricos, 0); | |
//inicializar variable | |
pinMode (ledcd, OUTPUT); | |
pinMode (botoncd, INPUT); | |
digitalWrite (ledcd, 0); | |
//inicializar variable | |
pinMode (ledvidrios, OUTPUT); | |
pinMode (botonvidrios, INPUT); | |
digitalWrite (ledvidrios, 0); | |
//inicializar variable | |
pinMode (botonvidrios2, OUTPUT); | |
pinMode (ledvidrios2 , INPUT); | |
digitalWrite (ledvidrios2, 0); | |
} | |
void loop() | |
{ | |
if (analogRead(botonlucesa) <= 600 ) // cambiar boton dependiendo del pin | |
{ | |
Serial.println("boton Luces altas presionado"); | |
estadoalta = !estadoalta; | |
estadobaja = false; | |
delay(300); | |
} | |
if (estadoalta) { | |
digitalWrite (ledlucesa, 1); | |
} | |
else { | |
digitalWrite (ledlucesa, 0); | |
} | |
if (analogRead(botonlucesb) <= 600 ) | |
{ | |
Serial.println("boton luces bajas presionado"); // cambiar boton dependiendo del pin | |
estadobaja = !estadobaja; | |
estadoalta = false; | |
delay(300); | |
} | |
if (estadobaja) { | |
digitalWrite (ledlucesb, 1); | |
} | |
else { | |
digitalWrite (ledlucesb, 0); | |
} | |
if (analogRead(botoncricos) <= 600 ) | |
{ | |
Serial.println("boton sistema de cricos presionado"); // cambiar boton dependiendo del pin | |
estadocricos = !estadocricos; | |
delay(300); | |
} | |
if (estadocricos) { | |
digitalWrite (ledcricos, 1); | |
} | |
else { | |
digitalWrite (ledcricos, 0); | |
} | |
if (analogRead(botoncd) <= 600 ) | |
{ | |
Serial.println("boton sistema Audio presionado"); // cambiar boton dependiendo del pin | |
estadocd = !estadocd; | |
delay(300); | |
} | |
if (estadocd) { | |
digitalWrite (ledcd, 1); | |
} | |
else { | |
digitalWrite (ledcd, 0); | |
} | |
if (analogRead(botonlucesa) <= 600 ) | |
{ | |
Serial.println("boton sistema de eleva lunas presionado"); // cambiar boton dependiendo del pin | |
estadovidrios = !estadovidrios; | |
delay(300); | |
} | |
if (estadovidrios) { | |
digitalWrite (ledvidrios, 1); | |
} | |
else { | |
digitalWrite (ledvidrios, 0); | |
} | |
if (analogRead(botonlucesa) <= 600 ) | |
{ | |
Serial.println("boton sistema de eleva lunas presionado"); // cambiar boton dependiendo del pin | |
estadovidrios2 = !estadovidrios2; | |
delay(300); | |
} | |
if (estadovidrios2) { | |
digitalWrite (ledvidrios2, 1); | |
} | |
else { | |
digitalWrite (ledvidrios2, 0); | |
} | |
Blynk.run(); | |
} | |
BLYNK_WRITE(V1) | |
{ | |
estadoalta = !estadoalta; | |
estadobaja = false; | |
Serial.println ("activacion virtual de luces altas"); | |
} | |
BLYNK_WRITE(V2) | |
{ | |
estadobaja = !estadobaja; | |
estadoalta = false; | |
Serial.println ("activacion virtual de luces bajas"); | |
} | |
BLYNK_WRITE(V3) | |
{ | |
estadocricos = !estadocricos; | |
Serial.println ("activacion virtual de sistema de cricos"); | |
} | |
BLYNK_WRITE(V4) | |
{ | |
estadocd = !estadocd; | |
Serial.println ("activacion virtual de sistema de audio"); | |
} | |
BLYNK_WRITE(V5) | |
{ | |
estadovidrios = !estadovidrios; | |
estadovidrios2 = false; | |
Serial.println ("activacion virtual de sistema elevalunas"); | |
} | |
BLYNK_WRITE(V6) | |
{ | |
estadovidrios2 = !estadovidrios2; | |
estadovidrios = false; | |
Serial.println ("activacion virtual de sistema elevalunas"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment