Blynk로 쓰레기통 문 열기

마지막 스터디..에서는 스마트 휴지통을 IoT로 구현해보자!는 취지에서 저번시간에 했던 서보모터 컨트롤 회로를 그대로 쓰레기통에 부착되어있는 서보모터로 연결해주고 시도를 하며 마무리 해보자.

저번 시간에 했던 작업을 그대로 둔 상태에서, 쓰레기통의 서보모터와 연결만 시켜주면 된다. 배선을 잘 하고 꼬이지 않게 나름대로 정리해주면된다(밖에서만 안보이면 괜찮다..)

자, 그러면 Blynk로 쓰레기통 문을 열어보자!

NodeMCU Code

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
Servo servo;
BLYNK_WRITE(V3) 
{
   servo.write(param.asInt());
}
void setup() 
{
   // Debug console Serial.begin(115200);
   Blynk.begin(auth, ssid, pass);
   
   servo.attach(16); // NodeMCU의 D0핀에 연결
}
void loop()
{
  Blynk.run();
}

Leave a Reply

Your email address will not be published. Required fields are marked *