This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
example include file | |
*/ | |
void myPrintHelloMake(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <hellomake.h> | |
void myPrintHelloMake(void) { | |
printf("Hello makefiles!\n"); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <hellomake.h> | |
int main() { | |
// call a function in another file | |
myPrintHelloMake(); | |
return(0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
CFLAGS=-I. | |
hellomake: hellomake.o hellofunc.o | |
$(CC) -o hellomake hellomake.o hellofunc.o -I. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
CFLAGS=-I. | |
DEPS = hellomake.h | |
OBJ = hellomake.o hellofunc.o | |
%.o: %.c $(DEPS) | |
$(CC) -c -o $@ $< $(CFLAGS) | |
hellomake: $(OBJ) | |
gcc -o $@ $^ $(CFLAGS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDIR =../include | |
CC=gcc | |
CFLAGS=-I$(IDIR) | |
ODIR=obj | |
LDIR =../lib | |
LIBS=-lm | |
_DEPS = hellomake.h |