---
# System prepended metadata

title: Step3-Blynk程式碼解釋
tags: [OpenHCI'24 Arduino]

---

# Step3-Blynk程式碼解釋

### 手機網路熱點分享
* 「SSID」、「Password」
    | SSID(手機名稱) | Password(熱點密碼) |
    | :--------: | :--------: |
    |![S__36192266_0](https://hackmd.io/_uploads/BJha-EzU0.jpg) |![S__36192268_0](https://hackmd.io/_uploads/ByzA-NGLA.jpg) |


## Arduino UNO

* 一樣



## Arduino D1 WiFi

```clike= C
#define BLYNK_TEMPLATE_ID "TMPL6yT9dVA4g"
#define BLYNK_TEMPLATE_NAME "Coin Bank"
#define BLYNK_AUTH_TOKEN "57W5Ehi30MIawC4XVUP9CJ4Er6yiXyea"

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = BLYNK_AUTH_TOKEN;  // Blynk Auth Token
char ssid[] = "SC_iPhone";  // Your WiFi SSID
char pass[] = "asdfghjkl";  // Your WiFi Password

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  if (Serial.available() > 0) {
    int coinCount = Serial.parseInt();
    Blynk.virtualWrite(V1, coinCount);  // Send coin count to Blynk virtual pin V1
  }
  Blynk.run();
}

```




### 補充：Blynk生成範例Code
* 點選 [Blynk Example Link](https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=GettingStarted%2FBlynkBlink)

* 填選，並複製程式碼
    ![Image 15](https://hackmd.io/_uploads/Hk10D9bLA.png)



