1
0
Fork 0
mirror of https://github.com/kou029w/k2ping.git synced 2025-01-19 00:18:00 +00:00
k2ping/src/k2ping.ino

41 lines
753 B
Arduino
Raw Normal View History

2017-04-14 21:57:19 +09:00
#include <ESP8266WiFi.h>
2017-04-15 13:06:48 +09:00
#include <Wire.h>
#include <LiquidCrystal.h>
2017-04-14 21:57:19 +09:00
2017-04-15 11:37:24 +09:00
// Digital pins for WeMos D1
static const uint8_t D[] = {3, 1, 16, 5, 4, 14, 12, 13, 0, 2, 15};
2017-04-14 21:57:19 +09:00
2017-04-15 13:06:48 +09:00
// LCD Keypad Shield for Arduino
LiquidCrystal lcd(D[8], D[9], D[4], D[5], D[6], D[7]);
2017-04-14 21:57:19 +09:00
void setup() {
2017-04-15 13:06:48 +09:00
lcd.begin(16, 2);
2017-04-15 11:56:44 +09:00
WiFi.begin("network-name", "pass-to-network");
2017-04-15 13:06:48 +09:00
lcd.print("Connecting");
lcd.setCursor(0, 1);
2017-04-15 11:56:44 +09:00
while (WiFi.status() != WL_CONNECTED) {
delay(500);
2017-04-15 13:06:48 +09:00
static uint8_t i = 0;
lcd.setCursor((i %= 32) % 16, 1);
if (i < 16) {
lcd.write(0xFF);
i++;
} else if (i < 32) {
lcd.print(" ");
i++;
}
2017-04-15 11:56:44 +09:00
}
2017-04-15 13:06:48 +09:00
lcd.clear();
lcd.print("Connected");
lcd.setCursor(0, 1);
lcd.print(WiFi.localIP());
2017-04-14 21:57:19 +09:00
}
void loop() {
;
2017-04-15 13:06:48 +09:00
}