Skip to content

Instantly share code, notes, and snippets.

View hocarm's full-sized avatar
🎃
Focusing

hocarm

🎃
Focusing
View GitHub Profile
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
// bạn thay đổi thông tin bên dưới cho phù hợp
const char* ssid = "ten_wifi";
const char* password = "mat_khau";
const char* mqtt_server = "ip_may_cai_node_red"; /// lấy ip bằng lệnh ifconfig, ví dụ 192.168.1.105
const uint16_t mqtt_port = 1883;
const byte ledPin = D0;
WiFiClient espClient;
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
// Cập nhật thông tin
// Thông tin về wifi
#define ssid "ten_wifi"
#define password "password"
// Thông tin về MQTT Broker
#define mqtt_server "m12.cloudmqtt.com" // Thay bằng thông tin của bạn
#define mqtt_topic_pub "demo" //Giữ nguyên nếu bạn tạo topic tên là demo
#define mqtt_topic_sub "demo"
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
// Cập nhật thông tin
// Thông tin về wifi
#define ssid "ten_wifi"
#define password "password"
// Thông tin về MQTT Broker
#define mqtt_server "m12.cloudmqtt.com" // Thay bằng thông tin của bạn
#define mqtt_topic_pub "demo" //Giữ nguyên nếu bạn tạo topic tên là demo
#define mqtt_topic_sub "demo"
/*
example include file
*/
void myPrintHelloMake(void);
#include <stdio.h>
#include <hellomake.h>
void myPrintHelloMake(void) {
printf("Hello makefiles!\n");
return;
}
#include <hellomake.h>
int main() {
// call a function in another file
myPrintHelloMake();
return(0);
}
CC=gcc
CFLAGS=-I.
DEPS = hellomake.h
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
hellomake: hellomake.o hellofunc.o
gcc -o hellomake hellomake.o hellofunc.o -I.
CC=gcc
CFLAGS=-I.
hellomake: hellomake.o hellofunc.o
$(CC) -o hellomake hellomake.o hellofunc.o -I.
CC=gcc
CFLAGS=-I.
DEPS = hellomake.h
OBJ = hellomake.o hellofunc.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
hellomake: $(OBJ)
gcc -o $@ $^ $(CFLAGS)
IDIR =../include
CC=gcc
CFLAGS=-I$(IDIR)
ODIR=obj
LDIR =../lib
LIBS=-lm
_DEPS = hellomake.h