Skip to content

Instantly share code, notes, and snippets.

@cagataycali
Last active June 12, 2019 17:19
Show Gist options
  • Save cagataycali/206c7c159d05d838390d428905180504 to your computer and use it in GitHub Desktop.
Save cagataycali/206c7c159d05d838390d428905180504 to your computer and use it in GitHub Desktop.
Nodemcu ve LCD ile web sitesindeki online sayacı

LCD -> NODEMCU / POTANSIYOMETRE

VSS -> GND

VDD -> 3.3V

V0 -> POTANSIYOMETRE DATA (ORTA PİN)

RS -> D1

RV -> GND

E -> D2

D4 -> D3

D5 -> D4 

D6 -> D5

D7 -> D6

A -> 3.3V

K -> GND

NOTE:

Potansiyometre sağ bacak GND

Potansiyometre sağ bacak 3.3V

const io = require('socket.io')()
let user = 0
io.on('connection', socket => {
++user
console.log('Someone connected');
io.sockets.emit('event', `${user} Online`)
socket.on('disconnect', function () {
--user
io.sockets.emit('event', `${user} Online`)
})
})
io.listen(process.env.PORT || 3000)
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <SocketIoClient.h>
#define USE_SERIAL Serial
#include <LiquidCrystal.h>;
ESP8266WiFiMulti WiFiMulti;
SocketIoClient webSocket;
LiquidCrystal lcd(5, 4, 0, 2, 14, 12);
void event(const char * payload, size_t length) {
USE_SERIAL.printf("got message: %s\n", payload);
lcd.setCursor(3, 0);
lcd.print(payload);
lcd.setCursor(3, 1);
lcd.print("Ders.im");
}
void setup() {
USE_SERIAL.begin(115200);
lcd.begin(16, 2);
USE_SERIAL.setDebugOutput(true);
USE_SERIAL.println();
USE_SERIAL.println();
USE_SERIAL.println();
for(uint8_t t = 4; t > 0; t--) {
USE_SERIAL.printf("[SETUP] BOOT WAIT %d...\n", t);
USE_SERIAL.flush();
delay(1000);
}
WiFiMulti.addAP("brsesen", "12345678");
while(WiFiMulti.run() != WL_CONNECTED) {
delay(100);
}
webSocket.on("event", event);
webSocket.begin("192.168.43.161", 3000, "/socket.io/?transport=websocket");
}
void loop() {
webSocket.loop();
}
@barisesen
Copy link

https://github.com/timum-viw/socket.io-client
kullanılan paket bu, burdaki adımları yapmamız lazım

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment