Skip to content

Instantly share code, notes, and snippets.

View hocarm's full-sized avatar
🎃
Focusing

hocarm

🎃
Focusing
View GitHub Profile
#include <Wire.h>
#include <SPI.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
Wire.begin(4, 5); // Chan 4,5 I2C cua ESP8266
RTC.begin(); // Khoi dong RTC
delay(500);
// Dong bo thoi gian voi may tinh
/*
This sketch shows an example of sending a reading to data.sparkfun.com once per day.
It uses the Sparkfun testing stream so the only customizing required is the WiFi SSID and password.
The Harringay Maker Space
License: Apache License v2
*/
#include <NTPtimeESP.h>
/* Hello World Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
//
// Copyright 2015 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#define FIREBASE_HOST "hocarm1.firebaseio.com" //Thay bằng địa chỉ firebase của bạn
#define FIREBASE_AUTH "" //Không dùng xác thực nên không đổi
#define WIFI_SSID "ten_wifi" //Thay wifi và mật khẩu
#define WIFI_PASSWORD "mat_khau"
void setup() {
Serial.begin(9600);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
#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;
}