-
-
Save neosarchizo/07bcdd7bd4e8cc6804baf5d86ee7ba79 to your computer and use it in GitHub Desktop.
[서울예술대학교 201701] 디지털아트전공실기 III - 4주차 - 1
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 <ESP8266_Lib.h> | |
#include <BlynkSimpleShieldEsp8266.h> | |
#include <SimpleTimer.h> | |
char auth[] = "YourAuthToken"; | |
char ssid[] = "YourNetworkName"; | |
char pass[] = "YourPassword"; | |
#include <SoftwareSerial.h> | |
SoftwareSerial EspSerial(8, 9); | |
#define ESP8266_BAUD 9600 | |
ESP8266 wifi(&EspSerial); | |
SimpleTimer timer; | |
WidgetLED led(V0); | |
void setup() | |
{ | |
Serial.begin(9600); | |
delay(10); | |
EspSerial.begin(ESP8266_BAUD); | |
delay(10); | |
Blynk.begin(auth, wifi, ssid, pass); | |
timer.setInterval(100L, updateLed); | |
} | |
void loop() | |
{ | |
Blynk.run(); | |
timer.run(); | |
} | |
void updateLed() { | |
int knob = analogRead(A0); | |
int ledBrightness = map(knob, 0, 1023, 0, 255); | |
led.setValue(ledBrightness); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment