Skip to content

Instantly share code, notes, and snippets.

@neosarchizo
Last active March 18, 2017 09:51
Show Gist options
  • Save neosarchizo/07bcdd7bd4e8cc6804baf5d86ee7ba79 to your computer and use it in GitHub Desktop.
Save neosarchizo/07bcdd7bd4e8cc6804baf5d86ee7ba79 to your computer and use it in GitHub Desktop.
[서울예술대학교 201701] 디지털아트전공실기 III - 4주차 - 1
#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