Giới thiệu sản phẩm
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
SimpleTimer timer;
char auth[] = "YjHxZ9N2JvJW-gVd75tbXOjAr0Fuyf5_";
char ssid[] = "TEKY OFFICE";
char pass[] = "Teky@2018";
int n;
#define IN1 5
#define IN2 4
#define IN3 12
#define IN4 13
#define maxspeed 255
#define minspeed 0
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass, "blynk-server.com",8080);
pinMode(IN1,OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(15,OUTPUT);
pinMode(5,OUTPUT);
timer.setInterval(1000L, sendUptime);
}
void sendUptime()
{
Blynk.virtualWrite(V7, n);
}
void loop() {
Blynk.run();
timer.run();
n=analogRead(A0);
Serial.println(n);
if(n>500)
{
digitalWrite(15,HIGH);
//digitalWrite(5,HIGH);
}
if(n<500)
{
digitalWrite(15,LOW);
//digitalWrite(5,LOW);
}
}
BLYNK_WRITE(V1) {
int pinValue = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue==1) {
analogWrite(IN1,255-speed);
analogWrite(IN4,255-speed);
}
else{
analogWrite(IN4,minspeed);
analogWrite(IN1,minspeed);
}
}
BLYNK_WRITE(V2) {
int pinValue2 = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue2==1) {
analogWrite(IN1,minspeed);
analogWrite(IN2,255-speed);
}
else{
analogWrite(IN2,minspeed);
analogWrite(IN1,minspeed);
}
}
BLYNK_WRITE(V3) {
int pinValue3 = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue3==1) {
analogWrite(IN3,255-speed);
analogWrite(IN4,minspeed);
}
else{
analogWrite(IN4,minspeed);
analogWrite(IN3,minspeed);
}
}
BLYNK_WRITE(V4) {
int pinValue4 = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue4==1) {
analogWrite(IN3,255-speed);
analogWrite(IN2,255-speed);
}
else{
analogWrite(IN2,minspeed);
analogWrite(IN3,minspeed);
}
}
BLYNK_WRITE(V5) {
int pinValue5 = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue5==1) {
analogWrite(IN2,minspeed);
analogWrite(IN1,255-speed);
}
else{
analogWrite(IN1,minspeed);
analogWrite(IN2,minspeed);
}
}
BLYNK_WRITE(V6) {
int pinValue6 = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue6==1) {
analogWrite(IN4,255-speed);
analogWrite(IN3,minspeed);
}
else{
analogWrite(IN3,minspeed);
analogWrite(IN4,minspeed);
}
}
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
SimpleTimer timer;
char auth[] = "YjHxZ9N2JvJW-gVd75tbXOjAr0Fuyf5_";
char ssid[] = "TEKY OFFICE";
char pass[] = "Teky@2018";
int n;
#define IN1 5
#define IN2 4
#define IN3 12
#define IN4 13
#define maxspeed 255
#define minspeed 0
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass, "blynk-server.com",8080);
pinMode(IN1,OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(15,OUTPUT);
pinMode(5,OUTPUT);
timer.setInterval(1000L, sendUptime);
}
void sendUptime()
{
Blynk.virtualWrite(V7, n);
}
void loop() {
Blynk.run();
timer.run();
n=analogRead(A0);
Serial.println(n);
if(n>500)
{
digitalWrite(15,HIGH);
//digitalWrite(5,HIGH);
}
if(n<500)
{
digitalWrite(15,LOW);
//digitalWrite(5,LOW);
}
}
BLYNK_WRITE(V1) {
int pinValue = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue==1) {
analogWrite(IN1,255-speed);
analogWrite(IN4,255-speed);
}
else{
analogWrite(IN4,minspeed);
analogWrite(IN1,minspeed);
}
}
BLYNK_WRITE(V2) {
int pinValue2 = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue2==1) {
analogWrite(IN1,minspeed);
analogWrite(IN2,255-speed);
}
else{
analogWrite(IN2,minspeed);
analogWrite(IN1,minspeed);
}
}
BLYNK_WRITE(V3) {
int pinValue3 = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue3==1) {
analogWrite(IN3,255-speed);
analogWrite(IN4,minspeed);
}
else{
analogWrite(IN4,minspeed);
analogWrite(IN3,minspeed);
}
}
BLYNK_WRITE(V4) {
int pinValue4 = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue4==1) {
analogWrite(IN3,255-speed);
analogWrite(IN2,255-speed);
}
else{
analogWrite(IN2,minspeed);
analogWrite(IN3,minspeed);
}
}
BLYNK_WRITE(V5) {
int pinValue5 = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue5==1) {
analogWrite(IN2,minspeed);
analogWrite(IN1,255-speed);
}
else{
analogWrite(IN1,minspeed);
analogWrite(IN2,minspeed);
}
}
BLYNK_WRITE(V6) {
int pinValue6 = param.asInt();
int speed = constrain (speed, minspeed, maxspeed);
if(pinValue6==1) {
analogWrite(IN4,255-speed);
analogWrite(IN3,minspeed);
}
else{
analogWrite(IN3,minspeed);
analogWrite(IN4,minspeed);
}
}
Hình ảnh sản phẩm
Hãy bình luận để nhặt 100 thóc nhé
Sản phẩm cùng tác giả
Sản phẩm liên quan
Không có sản phẩm nào
thấy mà sướng cả con mắt🙏
Đăng nhập để tham gia bình luận
Chất như nước cất 🔥💕
Đăng nhập để tham gia bình luận
👍👍👍cưng quá zậy
Đăng nhập để tham gia bình luận
ấn tượng thiệt🎀
Đăng nhập để tham gia bình luận
💪💪💪động lực là đây chứ đâu
Đăng nhập để tham gia bình luận
Đăng nhập để tham gia bình luận