├── .gitignore ├── blynkApp2ChannelNodemcu └── 1.png ├── Esp8266_telegramBot ├── Schematic.pdf ├── ESP12ERelayBoard.zip ├── connection_diagram.png └── Telegram-esp8266-2channel │ └── Telegram-esp8266-2channel.ino ├── SmartAgreeculture ├── SmartAgree_bb.jpg └── Ardiuno-code │ └── SmartAgreeIOT │ └── SmartAgreeIOT.ino ├── Clock_NTP_ESP32 ├── esp32_max7219_bb.jpg └── esp32-max7219-clock │ ├── esp32-max7219-clock.ino │ └── Font_Data.h ├── homeAutomationMqttAdafruit ├── Schematic.pdf ├── ESP12ERelayBoard.zip └── AdafruitHomeAutomation │ └── AdafruitHomeAutomation.ino ├── GoogleSpreadSheet_ESP32 ├── Esp32_GoogleSpreadSheet_bb.jpg ├── google_script.txt └── esp32-googleSpreadSheet │ └── esp32-googleSpreadSheet.ino ├── .github └── FUNDING.yml ├── GoogleSpreadSheet_ESP32_IFTTT ├── Esp32_GoogleSpreadSheet-ifttt_bb.jpg └── ESP32_GoogleSpreadSheetIFTTT │ └── ESP32_GoogleSpreadSheetIFTTT.ino ├── README.md ├── reyax_mqtt_cloud └── code │ ├── publish1 │ ├── arduino_secrets.h │ └── publish1.ino │ └── subscribe1 │ ├── arduino_secrets.h │ └── subscribe1.ino ├── GoogleSpreadSheet_Read_OLED ├── google_script │ └── google_script.gs └── arduino │ └── esp32-googleSpreadSheetRead │ └── esp32-googleSpreadSheetRead.ino ├── thingspeak └── thingspeak.ino ├── PostDataToGoogleSheet ├── script.txt └── PostDataToGoogleSheet.ino ├── esp32_gemini_ai └── esp32_gemini_ai.ino ├── esp32_wm_server ├── esp32_wm_server.ino └── index.h ├── Gmail-Notification └── sketch_oct21a.ino └── alexa-esp8266 └── alexa-esp8266.ino /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /blynkApp2ChannelNodemcu/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stechiez/iot_projects/HEAD/blynkApp2ChannelNodemcu/1.png -------------------------------------------------------------------------------- /Esp8266_telegramBot/Schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stechiez/iot_projects/HEAD/Esp8266_telegramBot/Schematic.pdf -------------------------------------------------------------------------------- /SmartAgreeculture/SmartAgree_bb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stechiez/iot_projects/HEAD/SmartAgreeculture/SmartAgree_bb.jpg -------------------------------------------------------------------------------- /Clock_NTP_ESP32/esp32_max7219_bb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stechiez/iot_projects/HEAD/Clock_NTP_ESP32/esp32_max7219_bb.jpg -------------------------------------------------------------------------------- /Esp8266_telegramBot/ESP12ERelayBoard.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stechiez/iot_projects/HEAD/Esp8266_telegramBot/ESP12ERelayBoard.zip -------------------------------------------------------------------------------- /homeAutomationMqttAdafruit/Schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stechiez/iot_projects/HEAD/homeAutomationMqttAdafruit/Schematic.pdf -------------------------------------------------------------------------------- /Esp8266_telegramBot/connection_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stechiez/iot_projects/HEAD/Esp8266_telegramBot/connection_diagram.png -------------------------------------------------------------------------------- /homeAutomationMqttAdafruit/ESP12ERelayBoard.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stechiez/iot_projects/HEAD/homeAutomationMqttAdafruit/ESP12ERelayBoard.zip -------------------------------------------------------------------------------- /GoogleSpreadSheet_ESP32/Esp32_GoogleSpreadSheet_bb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stechiez/iot_projects/HEAD/GoogleSpreadSheet_ESP32/Esp32_GoogleSpreadSheet_bb.jpg -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [stechiez] 4 | patreon: stechiez 5 | custom: https://www.buymeacoffee.com/stechiezdiy 6 | -------------------------------------------------------------------------------- /GoogleSpreadSheet_ESP32_IFTTT/Esp32_GoogleSpreadSheet-ifttt_bb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stechiez/iot_projects/HEAD/GoogleSpreadSheet_ESP32_IFTTT/Esp32_GoogleSpreadSheet-ifttt_bb.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # esp8266 2 | Esp8266 related projects and reference material 3 | 4 | ## follow My channel for more IoT Videos 5 | https://www.youtube.com/c/stechiezdiy 6 | 7 | ## Support My channel 8 | https://www.buymeacoffee.com/stechiezdiy 9 | 10 | 11 | -------------------------------------------------------------------------------- /reyax_mqtt_cloud/code/publish1/arduino_secrets.h: -------------------------------------------------------------------------------- 1 | #define WIFI_SSID "xxxxxx" //ENTER WIFI SSID HERE 2 | #define WIFI_PASS "xxxxxxxxxx" //ENTER WIFI PASSWORD HERE 3 | #define MQTT_BROKER "iot.reyax.com" 4 | #define MQTT_USER "xxxxxxxxxx" //ENTER REYAX USERNAME 5 | #define MQTT_PASS "xxxxxxxxxx" //ENTER REYAX PASSWORD 6 | #define MQTT_CLID "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" //ENTER DEVICE ID HERE 7 | #define MQTT_PORT 1883 8 | #define MQTT_TOPIC "msg" 9 | -------------------------------------------------------------------------------- /reyax_mqtt_cloud/code/subscribe1/arduino_secrets.h: -------------------------------------------------------------------------------- 1 | #define WIFI_SSID "xxxxxx" //ENTER WIFI SSID HERE 2 | #define WIFI_PASS "xxxxxxxxxx" //ENTER WIFI PASSWORD HERE 3 | #define MQTT_BROKER "iot.reyax.com" 4 | #define MQTT_USER "xxxxxxxxxx" //ENTER REYAX USERNAME 5 | #define MQTT_PASS "xxxxxxxxxx" //ENTER REYAX PASSWORD 6 | #define MQTT_CLID "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" //ENTER DEVICE ID HERE 7 | #define MQTT_PORT 1883 8 | #define MQTT_TOPIC "msg" 9 | -------------------------------------------------------------------------------- /GoogleSpreadSheet_Read_OLED/google_script/google_script.gs: -------------------------------------------------------------------------------- 1 | //https://script.google.com/macros/s/AKfycbzdaV09fHKI9EXjSGqsvhULyvYjJPMojpT9nuZ_rPohTW9qkC3sdaBKCO7EEyIpOlHW/exec 2 | var ss = SpreadsheetApp.openById('1WTxdn11J9ATKfBsf8W8xO2NrV_USE4V3TO62bwsRID8'); 3 | var sheet = ss.getSheetByName('Sheet1'); 4 | 5 | function doPost(e) { 6 | var val = e.parameter.value; 7 | 8 | if (e.parameter.value !== undefined){ 9 | var range = sheet.getRange('A2'); 10 | range.setValue(val); 11 | } 12 | } 13 | 14 | function doGet(e){ 15 | var read = e.parameter.read; 16 | 17 | if (read !== undefined){ 18 | return ContentService.createTextOutput(sheet.getRange('C2').getValue()); 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /thingspeak/thingspeak.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | String apiKey = "7CDCTE2767Z8AUIL"; // Enter your Write API key from ThingSpeak 6 | 7 | const char *ssid = "hidden"; // replace with your wifi ssid and wpa2 key 8 | const char *pass = "qwerty12"; 9 | const char* server = "api.thingspeak.com"; 10 | 11 | WiFiClient client; 12 | Adafruit_MLX90614 mlx = Adafruit_MLX90614(); 13 | 14 | 15 | int objTemp; 16 | int ambTemp; 17 | 18 | void setup() 19 | { 20 | Serial.begin(115200); 21 | delay(10); 22 | 23 | Serial.println("Connecting to "); 24 | Serial.println(ssid); 25 | 26 | 27 | WiFi.begin(ssid, pass); 28 | 29 | while (WiFi.status() != WL_CONNECTED) 30 | { 31 | delay(500); 32 | Serial.print("."); 33 | } 34 | Serial.println(""); 35 | Serial.println("WiFi connected"); 36 | mlx.begin(); 37 | Wire.begin(D1,D2); 38 | 39 | } 40 | 41 | void loop() 42 | { 43 | 44 | if (client.connect(server,80)) // "184.106.153.149" or api.thingspeak.com 45 | { 46 | objTemp = mlx.readObjectTempC(); 47 | ambTemp = mlx.readObjectTempC(); 48 | String postStr = apiKey; 49 | postStr +="&field1="; 50 | postStr += String(objTemp); 51 | postStr += "\r\n\r\n"; 52 | 53 | client.print("POST /update HTTP/1.1\n"); 54 | client.print("Host: api.thingspeak.com\n"); 55 | client.print("Connection: close\n"); 56 | client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n"); 57 | client.print("Content-Type: application/x-www-form-urlencoded\n"); 58 | client.print("Content-Length: "); 59 | client.print(postStr.length()); 60 | client.print("\n\n"); 61 | client.print(postStr); 62 | 63 | Serial.print("Ambient = "); Serial.print(ambTemp); 64 | Serial.print("*C\tObject = "); Serial.print(objTemp); Serial.println("*C"); 65 | 66 | } 67 | client.stop(); 68 | 69 | delay(2000); 70 | } 71 | -------------------------------------------------------------------------------- /PostDataToGoogleSheet/script.txt: -------------------------------------------------------------------------------- 1 | function doGet(e){ 2 | Logger.log("--- doGet ---"); 3 | 4 | var tag = "", 5 | value = ""; 6 | 7 | try { 8 | 9 | // this helps during debuggin 10 | if (e == null){e={}; e.parameters = {tag:"test",value:"-1"};} 11 | 12 | tag = e.parameters.tag; 13 | value = e.parameters.value; 14 | 15 | // save the data to spreadsheet 16 | save_data(tag, value); 17 | 18 | 19 | return ContentService.createTextOutput("Wrote:\n tag: " + tag + "\n value: " + value); 20 | 21 | } catch(error) { 22 | Logger.log(error); 23 | return ContentService.createTextOutput("oops...." + error.message 24 | + "\n" + new Date() 25 | + "\ntag: " + tag + 26 | + "\nvalue: " + value); 27 | } 28 | } 29 | 30 | // Method to save given data to a sheet 31 | function save_data(tag, value){ 32 | Logger.log("--- save_data ---"); 33 | 34 | 35 | try { 36 | var dateTime = new Date(); 37 | 38 | // Paste the URL of the Google Sheets starting from https thru /edit 39 | // For e.g.: https://docs.google.com/..../edit 40 | var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/-----ReplaceYoursheetIDHere-----------/edit"); 41 | var dataLoggerSheet = ss.getSheetByName("Datalogger"); 42 | 43 | 44 | // Get last edited row from DataLogger sheet 45 | var row = dataLoggerSheet.getLastRow() + 1; 46 | 47 | 48 | // Start Populating the data 49 | dataLoggerSheet.getRange("A" + row).setValue(row -1); // ID 50 | dataLoggerSheet.getRange("B" + row).setValue(dateTime); // dateTime 51 | dataLoggerSheet.getRange("C" + row).setValue(tag); // tag 52 | dataLoggerSheet.getRange("D" + row).setValue(value); // value 53 | 54 | 55 | // Update summary sheet 56 | summarySheet.getRange("B1").setValue(dateTime); // Last modified date 57 | // summarySheet.getRange("B2").setValue(row - 1); // Count 58 | } 59 | 60 | catch(error) { 61 | Logger.log(JSON.stringify(error)); 62 | } 63 | 64 | Logger.log("--- save_data end---"); 65 | } -------------------------------------------------------------------------------- /GoogleSpreadSheet_ESP32/google_script.txt: -------------------------------------------------------------------------------- 1 | function doGet(e){ 2 | Logger.log("--- doGet ---"); 3 | 4 | var tag = "", 5 | value = ""; 6 | 7 | try { 8 | 9 | // this helps during debuggin 10 | if (e == null){e={}; e.parameters = {tag:"test",value:"-1"};} 11 | 12 | tag = e.parameters.tag; 13 | value = e.parameters.value; 14 | 15 | // save the data to spreadsheet 16 | save_data(tag, value); 17 | 18 | 19 | return ContentService.createTextOutput("Wrote:\n tag: " + tag + "\n value: " + value); 20 | 21 | } catch(error) { 22 | Logger.log(error); 23 | return ContentService.createTextOutput("oops...." + error.message 24 | + "\n" + new Date() 25 | + "\ntag: " + tag + 26 | + "\nvalue: " + value); 27 | } 28 | } 29 | 30 | // Method to save given data to a sheet 31 | function save_data(tag, value){ 32 | Logger.log("--- save_data ---"); 33 | 34 | 35 | try { 36 | var dateTime = new Date(); 37 | 38 | // Paste the URL of the Google Sheets starting from https thru /edit 39 | // For e.g.: https://docs.google.com/..../edit 40 | var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1MoCQirOFsgHcTmgckQ5qAtvzNBzumKgmBElluJibPBE/edit"); 41 | var dataLoggerSheet = ss.getSheetByName("Datalogger"); 42 | 43 | 44 | // Get last edited row from DataLogger sheet 45 | var row = dataLoggerSheet.getLastRow() + 1; 46 | 47 | 48 | // Start Populating the data 49 | dataLoggerSheet.getRange("A" + row).setValue(row -1); // ID 50 | dataLoggerSheet.getRange("B" + row).setValue(dateTime); // dateTime 51 | dataLoggerSheet.getRange("C" + row).setValue(tag); // tag 52 | dataLoggerSheet.getRange("D" + row).setValue(value); // value 53 | 54 | 55 | // Update summary sheet 56 | summarySheet.getRange("B1").setValue(dateTime); // Last modified date 57 | // summarySheet.getRange("B2").setValue(row - 1); // Count 58 | } 59 | 60 | catch(error) { 61 | Logger.log(JSON.stringify(error)); 62 | } 63 | 64 | Logger.log("--- save_data end---"); 65 | } -------------------------------------------------------------------------------- /esp32_gemini_ai/esp32_gemini_ai.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | const char* ssid = "WIFI_SSID_NAME"; 6 | const char* password = "WIFI_PASSWORD"; 7 | 8 | const char* API_KEY = "AIzaSyAcI3w_BTSrMoAGFujEP0G8F34xrlaPBbE"; 9 | const char* MAX_TOKENS = "120"; 10 | 11 | void initWiFi() { 12 | WiFi.mode(WIFI_STA); 13 | WiFi.begin(ssid, password); 14 | Serial.print("Connecting to WiFi .."); 15 | while (WiFi.status() != WL_CONNECTED) { 16 | Serial.print('.'); 17 | delay(1000); 18 | } 19 | Serial.println(WiFi.localIP()); 20 | } 21 | 22 | void setup() { 23 | Serial.begin(115200); 24 | initWiFi(); 25 | Serial.println("Gemini AI Prompt started !!!"); 26 | } 27 | 28 | void loop() { 29 | String user_statement; 30 | 31 | Serial.println("->"); 32 | while (!Serial.available()); 33 | while (Serial.available()) { 34 | char c = Serial.read(); 35 | user_statement += c; 36 | } 37 | int len = user_statement.length(); 38 | user_statement = user_statement.substring(0, (len - 1)); 39 | user_statement = "\"" + user_statement + "\""; 40 | 41 | Serial.println("User : " + user_statement); 42 | 43 | HTTPClient https; 44 | if (https.begin("https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=" + (String)API_KEY)) { 45 | 46 | https.addHeader("Content-Type", "application/json"); 47 | String payload = String("{\"contents\": [{\"parts\":[{\"text\":" + user_statement + "}]}],\"generationConfig\": {\"maxOutputTokens\": " + (String)MAX_TOKENS + "}}"); 48 | 49 | // start connection and send HTTP header 50 | int httpCode = https.POST(payload); 51 | 52 | if ((httpCode == HTTP_CODE_OK) || (httpCode == HTTP_CODE_MOVED_PERMANENTLY)) { 53 | String payload = https.getString(); 54 | 55 | DynamicJsonDocument doc(1024); 56 | deserializeJson(doc, payload); 57 | String Answer = doc["candidates"][0]["content"]["parts"][0]["text"]; 58 | 59 | Serial.println("Gemini AI Response: "); 60 | Serial.println(Answer); 61 | } else { 62 | Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str()); 63 | } 64 | https.end(); 65 | } else { 66 | Serial.printf("[HTTPS] Unable to connect\n"); 67 | } 68 | Serial.println("____________________________________________________________________________"); 69 | user_statement = ""; 70 | } 71 | -------------------------------------------------------------------------------- /esp32_wm_server/esp32_wm_server.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "index.h" 8 | 9 | const char* http_username = "stechiez"; 10 | const char* http_password = "test1234"; 11 | 12 | AsyncWebServer server(80); // Create an instance of the AsyncWebServer 13 | 14 | int nCounter; 15 | 16 | void notFound(AsyncWebServerRequest *request) { 17 | request->send(404, "text/plain", "Not found"); 18 | } 19 | 20 | void setup() { 21 | pinMode(LED_BUILTIN, OUTPUT); 22 | 23 | WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP 24 | // it is a good practice to make sure your code sets wifi mode how you want it. 25 | 26 | // put your setup code here, to run once: 27 | Serial.begin(115200); 28 | 29 | //WiFiManager, Local intialization. Once its business is done, there is no need to keep it around 30 | WiFiManager wm; 31 | //wm.resetSettings(); 32 | 33 | bool res; 34 | // res = wm.autoConnect(); // auto generated AP name from chipid 35 | // res = wm.autoConnect("AutoConnectAP"); // anonymous ap 36 | res = wm.autoConnect("AutoConnectAP","password"); // password protected ap 37 | 38 | if(!res) { 39 | Serial.println("Failed to connect"); 40 | // ESP.restart(); 41 | } 42 | else { 43 | Serial.println("connected...yeey :)"); 44 | } 45 | 46 | server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) { 47 | if (!request->authenticate(http_username, http_password)) 48 | return request->requestAuthentication(); 49 | request->send_P(200, "text/html", index_html, NULL); 50 | }); 51 | 52 | server.on("/adc_value", HTTP_GET, [](AsyncWebServerRequest * request) { 53 | nCounter ++; 54 | request->send(200, "text/html", String(nCounter)); 55 | }); 56 | 57 | server.on("/led_toggle", HTTP_GET, [](AsyncWebServerRequest * request) { 58 | Serial.println("LED Toggled!!!"); 59 | digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); 60 | request->send(200, "text/html", ""); 61 | }); 62 | 63 | server.on("/get", HTTP_GET, [] (AsyncWebServerRequest * request) { 64 | String inputMessage; 65 | String inputParam; 66 | 67 | Serial.println(inputMessage); 68 | request->send(200, "text/html", index_html); 69 | }); 70 | server.onNotFound(notFound); 71 | server.begin(); 72 | } 73 | 74 | void loop() { 75 | 76 | } 77 | -------------------------------------------------------------------------------- /GoogleSpreadSheet_ESP32_IFTTT/ESP32_GoogleSpreadSheetIFTTT/ESP32_GoogleSpreadSheetIFTTT.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "DHT.h" 4 | 5 | #define LDR_PIN 36 6 | #define DHTPIN 23 7 | 8 | //our sensor is DHT11 type 9 | #define DHTTYPE DHT11 10 | DHT dht(DHTPIN, DHTTYPE); 11 | 12 | const char * ssid = "sss"; 13 | const char * password = "qwerty12345"; 14 | 15 | String server = "http://maker.ifttt.com"; 16 | String eventName = "temp_data"; 17 | String IFTTT_Key = "e272MXJrh4_et5KUm56LmYHjJrNRtj9BjxUT5u6Njr7"; 18 | String IFTTTUrl="http://maker.ifttt.com/trigger/temp_data/with/key/e272MXJrh4_et5KUm56LmYHjJrNRtj9BjxUT5u6Njr7"; 19 | 20 | int value1; 21 | int value2; 22 | int value3; 23 | 24 | void setup() { 25 | Serial.begin(115200); 26 | dht.begin(); 27 | WiFi.mode(WIFI_STA); 28 | WiFi.begin(ssid, password); 29 | 30 | while (WiFi.status() != WL_CONNECTED) { 31 | delay(500); 32 | Serial.print("."); 33 | } 34 | Serial.println("Viola, Connected !!!"); 35 | } 36 | 37 | float getLightPercentage(void) 38 | { 39 | int ldrRawVal; 40 | float percentage; 41 | ldrRawVal = analogRead(LDR_PIN); 42 | percentage = ((float)((ldrRawVal*100)/4096)); 43 | return percentage; 44 | } 45 | 46 | void sendDataToSheet(void) 47 | { 48 | String url = server + "/trigger/" + eventName + "/with/key/" + IFTTT_Key + "?value1=" + String((int)value1) + "&value2="+String((int)value2) +"&value3=" + String((int)value3); 49 | Serial.println(url); 50 | //Start to send data to IFTTT 51 | HTTPClient http; 52 | Serial.print("[HTTP] begin...\n"); 53 | http.begin(url); //HTTP 54 | 55 | Serial.print("[HTTP] GET...\n"); 56 | // start connection and send HTTP header 57 | int httpCode = http.GET(); 58 | // httpCode will be negative on error 59 | if(httpCode > 0) { 60 | // HTTP header has been send and Server response header has been handled 61 | Serial.printf("[HTTP] GET... code: %d\n", httpCode); 62 | // file found at server 63 | if(httpCode == HTTP_CODE_OK) { 64 | String payload = http.getString(); 65 | Serial.println(payload); 66 | } 67 | } else { 68 | Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str()); 69 | } 70 | http.end(); 71 | 72 | } 73 | 74 | void loop() { 75 | value1 = dht.readHumidity(); 76 | value2 = dht.readTemperature(); 77 | value3 = getLightPercentage(); 78 | 79 | Serial.print("Values are "); 80 | Serial.print(value1); 81 | Serial.print(' '); 82 | Serial.print(value2); 83 | Serial.print(' '); 84 | Serial.println(value3); 85 | Serial.print(' '); 86 | 87 | sendDataToSheet(); 88 | delay(10000); 89 | } 90 | -------------------------------------------------------------------------------- /esp32_wm_server/index.h: -------------------------------------------------------------------------------- 1 | const char index_html[] PROGMEM = R"rawliteral( 2 | 3 | 4 | 5 | 6 | 7 | STechiezDIY 8 | 49 | 50 | 51 |
52 |

STechiezDIY

53 |
ADC Value: 0
54 | 55 | 56 |
57 | 58 | 93 | 94 | 95 | 96 | )rawliteral"; 97 | -------------------------------------------------------------------------------- /Esp8266_telegramBot/Telegram-esp8266-2channel/Telegram-esp8266-2channel.ino: -------------------------------------------------------------------------------- 1 | #include "CTBot.h" 2 | CTBot myBot; 3 | 4 | #define LIGHT_PIN1 5 5 | #define LIGHT_PIN2 12 6 | #define LIGHT_PIN3 4 7 | #define LIGHT_PIN4 13 8 | 9 | String ssid = "stechiez"; 10 | String pass = "qwerty123"; 11 | String token = "1321031443:AAG289f4etk7m8ujtmHuDuBFwTg_giNSi_A"; // REPLACE myToken WITH YOUR TELEGRAM BOT TOKEN 12 | uint8_t led = 2; 13 | 14 | 15 | void setup() { 16 | // initialize the Serial 17 | Serial.begin(115200); 18 | Serial.println("Starting TelegramBot..."); 19 | 20 | // connect the ESP8266 to the desired access point 21 | myBot.wifiConnect(ssid, pass); 22 | 23 | // set the telegram bot token 24 | myBot.setTelegramToken(token); 25 | 26 | // check if all things are ok 27 | if (myBot.testConnection()) 28 | Serial.println("\ntestConnection OK"); 29 | else 30 | Serial.println("\ntestConnection NOK"); 31 | 32 | // set the pin connected to the LED to act as output pin 33 | pinMode(led, OUTPUT); 34 | digitalWrite(led, HIGH); // turn off the led (inverted logic!) 35 | 36 | //Set mode top Output for the following pins 37 | pinMode(LIGHT_PIN1, OUTPUT); 38 | pinMode(LIGHT_PIN2, OUTPUT); 39 | pinMode(LIGHT_PIN3, OUTPUT); 40 | pinMode(LIGHT_PIN4, OUTPUT); 41 | 42 | 43 | 44 | } 45 | 46 | void loop() { 47 | // a variable to store telegram message data 48 | TBMessage msg; 49 | 50 | // if there is an incoming message... 51 | if (myBot.getNewMessage(msg)) { 52 | 53 | if (msg.text.equals("/hall_light_on")) { 54 | digitalWrite(LIGHT_PIN3, HIGH); 55 | myBot.sendMessage(msg.sender.id, "Hall Light is now ON"); 56 | } 57 | else if (msg.text.equals("/hall_light_off")) { 58 | digitalWrite(LIGHT_PIN3, LOW); 59 | myBot.sendMessage(msg.sender.id, "Hall Light is now OFF"); 60 | } 61 | else if (msg.text.equals("/gallery_light_on")) { 62 | digitalWrite(LIGHT_PIN4, HIGH); 63 | myBot.sendMessage(msg.sender.id, "Gallary Light is now OFF"); 64 | } 65 | else if (msg.text.equals("/gallery_light_off")) { 66 | digitalWrite(LIGHT_PIN4, LOW); 67 | myBot.sendMessage(msg.sender.id, "Gallary Light is now OFF"); 68 | } 69 | 70 | else if (msg.text.equals("/helpme")) { 71 | digitalWrite(led, HIGH); 72 | myBot.sendMessage(msg.sender.id, "Try sending following commands\n"); 73 | myBot.sendMessage(msg.sender.id, "/hall_light_on\n"); 74 | myBot.sendMessage(msg.sender.id, "/hall_light_off\n"); 75 | myBot.sendMessage(msg.sender.id, "/gallery_light_on\n"); 76 | myBot.sendMessage(msg.sender.id, "/gallery_light_off\n"); 77 | myBot.sendMessage(msg.sender.id, "/helpme\n"); 78 | myBot.sendMessage(msg.sender.id, "/nothing\n"); 79 | } 80 | else { 81 | // generate the message for the sender 82 | String reply; 83 | reply = (String)"Welcome " + msg.sender.username + (String)"try /helpme"; 84 | myBot.sendMessage(msg.sender.id, reply); 85 | } 86 | } 87 | // wait 500 milliseconds 88 | delay(500); 89 | } 90 | -------------------------------------------------------------------------------- /Clock_NTP_ESP32/esp32-max7219-clock/esp32-max7219-clock.ino: -------------------------------------------------------------------------------- 1 | // Header file includes 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "Font_Data.h" 8 | 9 | #define HARDWARE_TYPE MD_MAX72XX::FC16_HW 10 | #define MAX_DEVICES 4 11 | 12 | #define CLK_PIN 18 // or SCK 13 | #define DATA_PIN 19 // or MOSI 14 | #define CS_PIN 5 // or SS 15 | 16 | // Arbitrary output pins 17 | MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES); 18 | 19 | #define SPEED_TIME 75 20 | #define PAUSE_TIME 0 21 | #define MAX_MESG 20 22 | 23 | /********** User Config Setting ******************************/ 24 | char* ssid = "hidden"; 25 | char* password = "malhar@021"; 26 | //calculate your timezone in seconds,1 hour = 3600 seconds and 5.30Hrs = 19800 27 | const int timezoneinSeconds = 19800; 28 | /***************************************************************/ 29 | int dst = 0; 30 | uint16_t h, m, s; 31 | uint8_t dow; 32 | int day; 33 | uint8_t month; 34 | String year; 35 | // Global variables 36 | char szTime[9]; // mm:ss\0 37 | char szsecond[4]; // ss 38 | char szMesg[MAX_MESG+1] = ""; 39 | 40 | 41 | void getsec(char *psz) 42 | { 43 | sprintf(psz, "%02d", s); 44 | } 45 | 46 | void getTime(char *psz, bool f = true) 47 | { 48 | time_t now = time(nullptr); 49 | struct tm* p_tm = localtime(&now); 50 | h = p_tm->tm_hour; 51 | m = p_tm->tm_min; 52 | s = p_tm->tm_sec; 53 | sprintf(psz, "%02d%c%02d", h, (f ? ':' : ' '), m); 54 | Serial.println(psz); 55 | } 56 | 57 | void setup(void) 58 | { 59 | Serial.begin(115200); 60 | delay(10); 61 | 62 | Serial.println(); 63 | Serial.println(); 64 | Serial.print("Connecting to "); 65 | Serial.println(ssid); 66 | 67 | WiFi.begin(ssid, password); 68 | 69 | while (WiFi.status() != WL_CONNECTED) { 70 | delay(500); 71 | Serial.print("."); 72 | } 73 | 74 | Serial.println(""); 75 | Serial.println("WiFi connected"); 76 | Serial.println("IP address: "); 77 | Serial.println(WiFi.localIP()); 78 | delay(3000); 79 | WiFi.mode(WIFI_STA); 80 | getTimentp(); 81 | 82 | P.begin(3); 83 | P.setInvert(false); 84 | 85 | P.setZone(0, 0, 0); 86 | P.setZone(1, 1, 3); 87 | P.setFont(0, numeric7Seg); 88 | P.setFont(1, numeric7Se); 89 | P.displayZoneText(0, szsecond, PA_LEFT, SPEED_TIME, 0, PA_PRINT, PA_NO_EFFECT); 90 | P.displayZoneText(1, szTime, PA_CENTER, SPEED_TIME, PAUSE_TIME, PA_PRINT, PA_NO_EFFECT); 91 | 92 | getTime(szTime); 93 | } 94 | 95 | void loop(void) 96 | { 97 | static uint32_t lastTime = 0; // millis() memory 98 | static uint8_t display = 0; // current display mode 99 | static bool flasher = false; // seconds passing flasher 100 | 101 | P.displayAnimate(); 102 | 103 | if (millis() - lastTime >= 1000) 104 | { 105 | lastTime = millis(); 106 | getsec(szsecond); 107 | getTime(szTime, flasher); 108 | flasher = !flasher; 109 | 110 | P.displayReset(0); 111 | P.displayReset(1); 112 | } 113 | } 114 | 115 | void getTimentp() 116 | { 117 | configTime(timezoneinSeconds, dst, "pool.ntp.org","time.nist.gov"); 118 | while(!time(nullptr)){ 119 | delay(500); 120 | Serial.print("."); 121 | } 122 | Serial.print("Time Update"); 123 | } 124 | -------------------------------------------------------------------------------- /PostDataToGoogleSheet/PostDataToGoogleSheet.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "HTTPSRedirect.h" 3 | #include 4 | #include 5 | 6 | // Fill ssid and password with your network credentials 7 | const char* ssid = "hidden"; 8 | const char* password = "qwerty12"; 9 | 10 | const char* host = "script.google.com"; 11 | const int httpsPort = 443; 12 | const char *GScriptId = "AKfycbwhcnmC6cSE_P5MKice-T6GX8pfe4rFFNiKUnY9-vuwE9hwzCA"; 13 | 14 | // Write to Google Spreadsheet 15 | String url = String("/macros/s/") + GScriptId + "/exec?tag=adc_A0&value="; 16 | 17 | String payload = ""; 18 | 19 | HTTPSRedirect* client = nullptr; 20 | // used to store the values of free stack and heap 21 | // before the HTTPSRedirect object is instantiated 22 | // so that they can be written to Google sheets 23 | // upon instantiation 24 | 25 | const int analog_ip = A0; 26 | int inputVal = 0; 27 | Adafruit_MLX90614 mlx = Adafruit_MLX90614(); 28 | 29 | void setup() { 30 | Serial.begin(115200); 31 | Serial.flush(); 32 | 33 | Serial.println(); 34 | Serial.print("Connecting to wifi: "); 35 | Serial.println(ssid); 36 | Wire.begin(D1,D2); 37 | // flush() is needed to print the above (connecting...) message reliably, 38 | // in case the wireless connection doesn't go through 39 | Serial.flush(); 40 | 41 | WiFi.begin(ssid, password); 42 | while (WiFi.status() != WL_CONNECTED) { 43 | delay(500); 44 | Serial.print("."); 45 | } 46 | Serial.println(""); 47 | Serial.println("WiFi connected"); 48 | Serial.println("IP address: "); 49 | Serial.println(WiFi.localIP()); 50 | 51 | // Use HTTPSRedirect class to create a new TLS connection 52 | client = new HTTPSRedirect(httpsPort); 53 | client->setPrintResponseBody(true); 54 | client->setContentTypeHeader("application/json"); 55 | 56 | Serial.print("Connecting to "); 57 | Serial.println(host); 58 | 59 | // Try to connect for a maximum of 5 times 60 | bool flag = false; 61 | for (int i=0; i<5; i++){ 62 | int retval = client->connect(host, httpsPort); 63 | if (retval == 1) { 64 | flag = true; 65 | break; 66 | } 67 | else 68 | Serial.println("Connection failed. Retrying..."); 69 | } 70 | 71 | if (!flag){ 72 | Serial.print("Could not connect to server: "); 73 | Serial.println(host); 74 | Serial.println("Exiting..."); 75 | return; 76 | } 77 | 78 | payload = "tag=aaaa&value=122"; 79 | client->POST(url, host, payload, false); 80 | client->GET(url, host); 81 | } 82 | 83 | void loop() { 84 | static int connect_count = 0; 85 | static bool flag = false; 86 | 87 | 88 | Serial.print("Ambient = "); 89 | inputVal = mlx.readObjectTempC(); 90 | Serial.print(inputVal); 91 | Serial.println("*C"); 92 | 93 | String myString = String(inputVal); 94 | String FinalStringToSend; 95 | FinalStringToSend = url + myString; 96 | 97 | 98 | if (client != nullptr){ 99 | if (!client->connected()){ 100 | client->connect(host, httpsPort); 101 | payload= ""; 102 | Serial.println("POST Data to Sheet"); 103 | // FinalStringToSend = url + myString; 104 | Serial.println("POST url :" + FinalStringToSend); 105 | client->POST(FinalStringToSend, host, payload); 106 | } 107 | } 108 | else{ 109 | Serial.println(" >> Failed to POST data"); 110 | } 111 | Serial.println("GET url :"+FinalStringToSend); 112 | client->GET(FinalStringToSend, host); 113 | 114 | delay(500); 115 | 116 | } 117 | 118 | 119 | -------------------------------------------------------------------------------- /GoogleSpreadSheet_ESP32/esp32-googleSpreadSheet/esp32-googleSpreadSheet.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define ThermistorPin 35 5 | #define LDR_PIN 34 6 | 7 | #define R1 10000 8 | #define C1 (float)1.009249522e-03 9 | #define C2 (float)2.378405444e-04 10 | #define C3 (float)2.019202697e-07 11 | 12 | //Things to change 13 | const char * ssid = "stech"; 14 | const char * password = "asdfg321"; 15 | 16 | String GOOGLE_SCRIPT_ID = "AKfycbwhcnmC6cSE_P5MKice-T6GX8pfe4rFFNiKUnY9-vuwE9hwzCA"; 17 | //https://script.google.com/macros/s/AKfycbwhcnmC6cSE_P5MKice-T6GX8pfe4rFFNiKUnY9-vuwE9hwzCA/exec?tag=adc_A0&value=123 18 | 19 | const int sendInterval = 5000; 20 | float avg[3]={0,0,0}; 21 | 22 | char light_array[7]; 23 | char temp_array[7]; 24 | 25 | //updated 04.12.2019 26 | const char * root_ca=\ 27 | "-----BEGIN CERTIFICATE-----\n" \ 28 | "MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G\n" \ 29 | "A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp\n" \ 30 | "Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1\n" \ 31 | "MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG\n" \ 32 | "A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI\n" \ 33 | "hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL\n" \ 34 | "v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8\n" \ 35 | "eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq\n" \ 36 | "tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd\n" \ 37 | "C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa\n" \ 38 | "zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB\n" \ 39 | "mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH\n" \ 40 | "V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n\n" \ 41 | "bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG\n" \ 42 | "3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs\n" \ 43 | "J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO\n" \ 44 | "291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS\n" \ 45 | "ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd\n" \ 46 | "AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7\n" \ 47 | "TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==\n" \ 48 | "-----END CERTIFICATE-----\n"; 49 | 50 | 51 | WiFiClientSecure client; 52 | 53 | void setup() { 54 | Serial.begin(115200); 55 | delay(10); 56 | 57 | WiFi.mode(WIFI_STA); 58 | WiFi.begin(ssid, password); 59 | 60 | Serial.println("Started"); 61 | Serial.print("Connecting"); 62 | while (WiFi.status() != WL_CONNECTED) { 63 | delay(500); 64 | Serial.print("."); 65 | } 66 | 67 | Serial.println("Ready to go"); 68 | } 69 | 70 | 71 | //NTC Temparature Reading and Processing 72 | float getTemperature(void) 73 | { 74 | static int avgArrayIndex=0; 75 | int Vo; 76 | float logR2,R2, T, Tc; 77 | Vo = analogRead(ThermistorPin); 78 | R2 = R1 * (4096.0 / (float)Vo - 1.0); 79 | logR2 = log(R2); 80 | T = (1.0 / (C1 + C2*logR2 + C3*logR2*logR2*logR2)); 81 | Tc = T - 273.15; 82 | avg[avgArrayIndex++] = Tc; 83 | if(avgArrayIndex > 2) 84 | avgArrayIndex = 0; 85 | Tc = (avg[0] + avg[1] + avg[2])/3; 86 | return Tc; 87 | } 88 | 89 | float getLightPercentage(void) 90 | { 91 | int ldrRawVal; 92 | float percentage; 93 | ldrRawVal = analogRead(LDR_PIN); 94 | percentage = ((float)((ldrRawVal*100)/4096)); 95 | return percentage; 96 | } 97 | 98 | void loop() { 99 | float lightpercentage = getLightPercentage(); 100 | float temp = getTemperature(); 101 | String temp_s(temp); 102 | String lightPer_s(lightpercentage); 103 | 104 | sendData("tag=adc_A0&value="+lightPer_s); 105 | delay(sendInterval); 106 | } 107 | 108 | void sendData(String params) { 109 | HTTPClient http; 110 | String url="https://script.google.com/macros/s/"+GOOGLE_SCRIPT_ID+"/exec?"+params; 111 | Serial.print(url); 112 | Serial.print("Making a request"); 113 | http.begin(url, root_ca); //Specify the URL and certificate 114 | int httpCode = http.GET(); 115 | http.end(); 116 | Serial.println(": done "+httpCode); 117 | } 118 | -------------------------------------------------------------------------------- /Gmail-Notification/sketch_oct21a.ino: -------------------------------------------------------------------------------- 1 | #include // Include the HTTPS library 2 | #include // Include the Wi-Fi library 3 | #include // Include the Wi-Fi-Multi library 4 | #include 5 | #include "SSD1306Wire.h" 6 | 7 | 8 | #define SDA_PIN D0 9 | #define SCL_PIN D1 10 | 11 | ESP8266WiFiMulti wifiMulti; // Create an instance of the ESP8266WiFiMulti class, called 'wifiMulti' 12 | SSD1306Wire display(0x3c, D2, D1); 13 | 14 | const char* host = "mail.google.com"; // the Gmail server 15 | const char* url = "/mail/feed/atom"; // the Gmail feed url 16 | const int httpsPort = 443; // the port to connect to the email server 17 | 18 | // The SHA-1 fingerprint of the SSL certificate for the Gmail server (see below) 19 | const char* fingerprint = "A6 55 A6 88 B3 88 98 B8 46 1C AF 84 FE 43 7B 9F A1 10 5A 5D"; 20 | 21 | //echo -n "email.address@gmail.com:password" | base64 22 | const char* credentials = "ZXAuaG9iYnlpabcdefghijklmnNvbTpTYWFnQFNURUNI"; 23 | 24 | const byte led = 13; 25 | 26 | 27 | void setup() { 28 | Serial.begin(115200); // Start the Serial communication to send messages to the computer 29 | delay(10); 30 | Serial.println('\n'); 31 | pinMode(led, OUTPUT); 32 | 33 | /*************************/ 34 | display.init(); 35 | display.flipScreenVertically(); 36 | display.setFont(ArialMT_Plain_16); 37 | display.drawString(0, 10, "Checking Mails"); 38 | display.display(); 39 | /*************************/ 40 | 41 | wifiMulti.addAP("hidden", "qwerty12"); // add Wi-Fi networks you want to connect to 42 | 43 | Serial.println("Connecting ..."); 44 | while (wifiMulti.run() != WL_CONNECTED) { // Wait for the Wi-Fi to connect: scan for Wi-Fi networks, and connect to the strongest of the networks above 45 | delay(250); 46 | Serial.print('.'); 47 | } 48 | Serial.println('\n'); 49 | Serial.print("Connected to "); 50 | Serial.println(WiFi.SSID()); // Tell us what network we're connected to 51 | Serial.print("IP address:\t"); 52 | Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer 53 | Serial.println('\n'); 54 | } 55 | 56 | void loop() { 57 | int unread = getUnread(); 58 | display.clear(); 59 | if (unread == 0) { 60 | Serial.println("\r\nYou've got no unread emails"); 61 | display.drawString(0, 10, "No New Mails"); 62 | display.display(); 63 | digitalWrite(led, LOW); 64 | } else if (unread > 0) { 65 | Serial.printf("\r\nYou've got %d new messages\r\n", unread); 66 | String str_unreadmails(unread); 67 | String StringToDisp = str_unreadmails+" Mails"; 68 | display.drawString(0, 0, "You've got"); 69 | display.drawString(0, 20, StringToDisp); 70 | display.display(); 71 | 72 | 73 | digitalWrite(led, HIGH); 74 | } else { 75 | Serial.println("Could not get unread mails"); 76 | } 77 | Serial.println('\n'); 78 | delay(5000); 79 | } 80 | 81 | int getUnread() { 82 | WiFiClientSecure client; 83 | Serial.printf("Connecting to %s:%d ... \r\n", host, httpsPort); 84 | if (!client.connect(host, httpsPort)) { // Connect to the Gmail server, on port 443 85 | Serial.println("Connection failed"); // If the connection fails, stop and return 86 | return -1; 87 | } 88 | 89 | // if (client.verify(fingerprint, host)) { // Check the SHA-1 fingerprint of the SSL certificate 90 | // Serial.println("Certificate matches"); 91 | // } else { // if it doesn't match, it's not safe to continue 92 | // Serial.println("Certificate doesn't match"); 93 | // return -1; 94 | // } 95 | 96 | Serial.print("Requesting URL: "); 97 | Serial.println(url); 98 | 99 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 100 | "Host: " + host + "\r\n" + 101 | "Authorization: Basic " + credentials + "\r\n" + 102 | "User-Agent: ESP8266\r\n" + 103 | "Connection: close\r\n\r\n"); // Send the HTTP request headers 104 | 105 | Serial.println("Request sent"); 106 | 107 | int unread = -1; 108 | 109 | while (client.connected()) { // Wait for the response. The response is in XML format 110 | // Serial.println(client.readStringUntil('<')); 111 | client.readStringUntil('<'); // read until the first XML tag 112 | String tagname = client.readStringUntil('>'); // read until the end of this tag to get the tag name 113 | if (tagname == "fullcount") { // if the tag is , the next string will be the number of unread emails 114 | String unreadStr = client.readStringUntil('<'); // read until the closing tag () 115 | unread = unreadStr.toInt(); // convert from String to int 116 | break; // stop reading 117 | } // if the tag is not , repeat and read the next tag 118 | } 119 | Serial.println("Connection closed"); 120 | 121 | return unread; // Return the number of unread emails 122 | } 123 | -------------------------------------------------------------------------------- /SmartAgreeculture/Ardiuno-code/SmartAgreeIOT/SmartAgreeIOT.ino: -------------------------------------------------------------------------------- 1 | //WIFI and ADC2 Channels are not working together hence using ADC1 channels 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #define ThermistorPin 35 10 | #define LDR_PIN 33 11 | #define SOIL_MOISTURE_PIN 34 12 | 13 | #define MOTOR 12 14 | 15 | #define R1 10000 16 | #define C1 (float)1.009249522e-03 17 | #define C2 (float)2.378405444e-04 18 | #define C3 (float)2.019202697e-07 19 | 20 | // Update these with values suitable for your network. 21 | const char* ssid = "hidden"; 22 | const char* password = "qwerty12"; 23 | const char* mqtt_server = "m15.cloudmqtt.com"; 24 | #define mqtt_port 16951 25 | #define MQTT_USER "mnkobdft" 26 | #define MQTT_PASSWORD "xOftMxYCCo91" 27 | #define MQTT_SERIAL_PUBLISH_LIGHT "stechiez/agree/light" 28 | #define MQTT_SERIAL_PUBLISH_TEMPERATUE "stechiez/agree/temp" 29 | #define MQTT_SERIAL_PUBLISH_SOIL "stechiez/agree/soil" 30 | #define MQTT_SERIAL_RECEIVER_MOTOR "stechiez/agree/motor" 31 | #define MQTT_SERIAL_RECEIVER_MOTOR_STATUS "stechiez/agree/mstatus" 32 | 33 | 34 | WiFiClient wifiClient; 35 | PubSubClient client(wifiClient); 36 | 37 | float avg[3]={0,0,0}; 38 | 39 | char light_array[7]; 40 | char soil_array[7]; 41 | char temp_array[7]; 42 | 43 | 44 | void setup_wifi() { 45 | delay(10); 46 | // We start by connecting to a WiFi network 47 | Serial.println(); 48 | Serial.print("Connecting to "); 49 | Serial.println(ssid); 50 | WiFi.begin(ssid, password); 51 | while (WiFi.status() != WL_CONNECTED) { 52 | delay(500); 53 | Serial.print("."); 54 | } 55 | randomSeed(micros()); 56 | Serial.println(""); 57 | Serial.println("WiFi connected"); 58 | Serial.println("IP address: "); 59 | Serial.println(WiFi.localIP()); 60 | } 61 | 62 | void reconnect() { 63 | // Loop until we're reconnected 64 | while (!client.connected()) { 65 | Serial.print("Attempting MQTT connection..."); 66 | // Create a random client ID 67 | String clientId = "ESP32Client-"; 68 | clientId += String(random(0xffff), HEX); 69 | // Attempt to connect 70 | if (client.connect(clientId.c_str(),MQTT_USER,MQTT_PASSWORD)) { 71 | Serial.println("connected"); 72 | //Once connected, publish an announcement... 73 | client.publish("/icircuit/presence/ESP32/", "hello world"); 74 | // ... and resubscribe 75 | client.subscribe(MQTT_SERIAL_RECEIVER_MOTOR); 76 | } else { 77 | Serial.print("failed, rc="); 78 | Serial.print(client.state()); 79 | Serial.println(" try again in 5 seconds"); 80 | // Wait 5 seconds before retrying 81 | delay(3000); 82 | } 83 | } 84 | } 85 | 86 | void callback(char* topic, byte *payload, unsigned int length) { 87 | Serial.println("-------new message from broker-----"); 88 | Serial.print("channel:"); 89 | Serial.println(topic); 90 | Serial.print("data:"); 91 | Serial.write(payload, length); 92 | Serial.println(); 93 | if(*payload == '0') 94 | { 95 | digitalWrite(MOTOR, 0); 96 | } 97 | else if(*payload == '1') 98 | { 99 | digitalWrite(MOTOR, 1); 100 | } 101 | } 102 | 103 | void publishSerialData(const char *pub_str,const char *serialData){ 104 | if (!client.connected()) { 105 | reconnect(); 106 | } 107 | client.publish(pub_str, serialData); 108 | } 109 | 110 | 111 | void setup() { 112 | Serial.begin(115200); 113 | pinMode(MOTOR, OUTPUT); 114 | 115 | Serial.setTimeout(500);// Set time out for 116 | setup_wifi(); 117 | client.setServer(mqtt_server, mqtt_port); 118 | client.setCallback(callback); 119 | reconnect(); 120 | digitalWrite(MOTOR, 0); 121 | } 122 | 123 | //NTC Temparature Reading and Processing 124 | float getTemperature(void) 125 | { 126 | static int avgArrayIndex=0; 127 | int Vo; 128 | float logR2,R2, T, Tc; 129 | Vo = analogRead(ThermistorPin); 130 | R2 = R1 * (4096.0 / (float)Vo - 1.0); 131 | logR2 = log(R2); 132 | T = (1.0 / (C1 + C2*logR2 + C3*logR2*logR2*logR2)); 133 | Tc = T - 273.15; 134 | avg[avgArrayIndex++] = Tc; 135 | if(avgArrayIndex > 2) 136 | avgArrayIndex = 0; 137 | Tc = (avg[0] + avg[1] + avg[2])/3; 138 | return Tc; 139 | } 140 | 141 | 142 | float getMoisturePercentage(void) 143 | { 144 | float moisture_percentage; 145 | int sensor_analog; 146 | sensor_analog = analogRead(SOIL_MOISTURE_PIN); 147 | moisture_percentage = ( 100 - ( (sensor_analog/4096.00) * 100 ) ); 148 | moisture_percentage = (float)moisture_percentage; 149 | return moisture_percentage; 150 | } 151 | 152 | float getLightPercentage(void) 153 | { 154 | int ldrRawVal; 155 | float percentage; 156 | ldrRawVal = analogRead(LDR_PIN); 157 | percentage = ((float)((ldrRawVal*100)/4096)); 158 | // percentage = 100 - percentage; 159 | return percentage; 160 | } 161 | 162 | void loop() { 163 | float lightpercentage = getLightPercentage(); 164 | float temp = getTemperature(); 165 | float soilMoisturePer = getMoisturePercentage(); 166 | String temp_s(temp); 167 | String soilPer_s(soilMoisturePer); 168 | String lightPer_s(lightpercentage); 169 | bool mstatus = digitalRead(MOTOR); 170 | String mstatus_s(mstatus); 171 | 172 | if(soilMoisturePer > 80.00) 173 | { 174 | digitalWrite(MOTOR, 0); 175 | } 176 | 177 | publishSerialData(MQTT_SERIAL_RECEIVER_MOTOR_STATUS,mstatus_s.c_str()); 178 | delay(2500); 179 | publishSerialData(MQTT_SERIAL_PUBLISH_SOIL,soilPer_s.c_str()); 180 | delay(250); 181 | publishSerialData(MQTT_SERIAL_PUBLISH_TEMPERATUE,temp_s.c_str()); 182 | delay(250); 183 | publishSerialData(MQTT_SERIAL_PUBLISH_LIGHT,lightPer_s.c_str()); 184 | delay(250); 185 | client.loop(); 186 | Serial.print("Temperature: "); 187 | Serial.print(temp); 188 | Serial.print(" C, LDR: "); 189 | Serial.print(lightpercentage,0); 190 | Serial.print("%"); 191 | Serial.print(" Moisture Percentage = "); 192 | Serial.print(soilMoisturePer); 193 | Serial.println("%"); 194 | // delay(400); 195 | } 196 | -------------------------------------------------------------------------------- /alexa-esp8266/alexa-esp8266.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include // https://github.com/kakopappa/sinric/wiki/How-to-add-dependency-libraries 5 | #include // https://github.com/kakopappa/sinric/wiki/How-to-add-dependency-libraries 6 | #include 7 | 8 | #define LIGHT_1 16 9 | #define LIGHT_2 5 10 | 11 | ESP8266WiFiMulti WiFiMulti; 12 | WebSocketsClient webSocket; 13 | WiFiClient client; 14 | 15 | ///////////WiFi Setup///////////// 16 | 17 | #define MyApiKey "25280b32-9f2f-4abe-9736-f1d59a1f484b" // TODO: Change to your sinric API Key. Your API Key is displayed on sinric.com dashboard 18 | #define MySSID "hidden" // TODO: Change to your Wifi network SSID 19 | #define MyWifiPassword "qwerty12345" // TODO: Change to your Wifi network password 20 | 21 | ///////////////////////////////// 22 | 23 | #define HEARTBEAT_INTERVAL 300000 // 5 Minutes 24 | 25 | uint64_t heartbeatTimestamp = 0; 26 | bool isConnected = false; 27 | 28 | // deviceId is the ID assgined to your smart-home-device in sinric.com dashboard. Copy it from dashboard and paste it here 29 | 30 | void turnOn(String deviceId) { 31 | if (deviceId == "5f4b7e42d1e9084a708199aa") // Device ID of first device 32 | { 33 | Serial.print("Turn on device id: "); 34 | Serial.println(deviceId); 35 | digitalWrite(LIGHT_1, LOW); 36 | } 37 | else if (deviceId == "5f4b8128d1e9084a70819a1c") // Device ID of second device 38 | { 39 | Serial.print("Turn on device id: "); 40 | Serial.println(deviceId); 41 | digitalWrite(LIGHT_2, LOW); 42 | } 43 | else { 44 | Serial.print("Turn on for unknown device id: "); 45 | Serial.println(deviceId); 46 | } 47 | } 48 | 49 | void turnOff(String deviceId) { 50 | if (deviceId == "5f4b7e42d1e9084a708199aa") // Device ID of first device 51 | { 52 | Serial.print("Turn off Device ID: "); 53 | Serial.println(deviceId); 54 | digitalWrite(LIGHT_1, HIGH); 55 | } 56 | else if (deviceId == "5f4b8128d1e9084a70819a1c") // Device ID of second device 57 | { 58 | Serial.print("Turn off Device ID: "); 59 | Serial.println(deviceId); 60 | digitalWrite(LIGHT_2, HIGH); 61 | } 62 | else { 63 | Serial.print("Turn off for unknown device id: "); 64 | Serial.println(deviceId); 65 | } 66 | } 67 | 68 | void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) { 69 | switch(type) { 70 | case WStype_DISCONNECTED: 71 | isConnected = false; 72 | Serial.printf("[WSc] Webservice disconnected from sinric.com!\n"); 73 | break; 74 | case WStype_CONNECTED: { 75 | isConnected = true; 76 | Serial.printf("[WSc] Service connected to sinric.com at url: %s\n", payload); 77 | Serial.printf("Waiting for commands from sinric.com ...\n"); 78 | } 79 | break; 80 | case WStype_TEXT: { 81 | Serial.printf("[WSc] get text: %s\n", payload); 82 | // Example payloads 83 | 84 | // For Switch or Light device types 85 | // {"deviceId": xxxx, "action": "setPowerState", value: "ON"} // https://developer.amazon.com/docs/device-apis/alexa-powercontroller.html 86 | 87 | // For Light device type 88 | // Look at the light example in github 89 | 90 | DynamicJsonBuffer jsonBuffer; 91 | JsonObject& json = jsonBuffer.parseObject((char*)payload); 92 | String deviceId = json ["deviceId"]; 93 | String action = json ["action"]; 94 | 95 | if(action == "setPowerState") { // Switch or Light 96 | String value = json ["value"]; 97 | if(value == "ON") { 98 | turnOn(deviceId); 99 | } else { 100 | turnOff(deviceId); 101 | } 102 | } 103 | else if (action == "SetTargetTemperature") { 104 | String deviceId = json ["deviceId"]; 105 | String action = json ["action"]; 106 | String value = json ["value"]; 107 | } 108 | else if (action == "test") { 109 | Serial.println("[WSc] received test command from sinric.com"); 110 | } 111 | } 112 | break; 113 | case WStype_BIN: 114 | Serial.printf("[WSc] get binary length: %u\n", length); 115 | break; 116 | } 117 | } 118 | 119 | void setup() { 120 | Serial.begin(115200); 121 | 122 | WiFiMulti.addAP(MySSID, MyWifiPassword); 123 | Serial.println(); 124 | Serial.print("Connecting to Wifi: "); 125 | Serial.println(MySSID); 126 | 127 | // Waiting for Wifi connect 128 | while(WiFiMulti.run() != WL_CONNECTED) { 129 | delay(500); 130 | Serial.print("."); 131 | } 132 | if(WiFiMulti.run() == WL_CONNECTED) { 133 | Serial.println(""); 134 | Serial.print("WiFi connected. "); 135 | Serial.print("IP address: "); 136 | Serial.println(WiFi.localIP()); 137 | } 138 | 139 | // server address, port and URL 140 | webSocket.begin("iot.sinric.com", 80, "/"); 141 | 142 | // event handler 143 | webSocket.onEvent(webSocketEvent); 144 | webSocket.setAuthorization("apikey", MyApiKey); 145 | 146 | // try again every 5000ms if connection has failed 147 | webSocket.setReconnectInterval(5000); // If you see 'class WebSocketsClient' has no member named 'setReconnectInterval' error update arduinoWebSockets 148 | 149 | pinMode(LIGHT_1, OUTPUT); 150 | pinMode(LIGHT_2, OUTPUT); 151 | 152 | digitalWrite(LIGHT_1, HIGH); 153 | digitalWrite(LIGHT_2, HIGH); 154 | } 155 | 156 | void loop() { 157 | webSocket.loop(); 158 | 159 | if(isConnected) { 160 | uint64_t now = millis(); 161 | 162 | // Send heartbeat in order to avoid disconnections during ISP resetting IPs over night. Thanks @MacSass 163 | if((now - heartbeatTimestamp) > HEARTBEAT_INTERVAL) { 164 | heartbeatTimestamp = now; 165 | webSocket.sendTXT("H"); 166 | } 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /homeAutomationMqttAdafruit/AdafruitHomeAutomation/AdafruitHomeAutomation.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Adafruit_MQTT.h" 3 | #include "Adafruit_MQTT_Client.h" 4 | 5 | // the on off button feed turns this LIGHT_PIN on/off 6 | #define LIGHT_PIN1 5 7 | #define LIGHT_PIN2 12 8 | #define LIGHT_PIN3 4 9 | #define LIGHT_PIN4 13 10 | 11 | 12 | /************************* WiFi Access Point *********************************/ 13 | 14 | #define WLAN_SSID "hidden" 15 | #define WLAN_PASS "qwerty12345" 16 | 17 | /************************* Adafruit.io Setup *********************************/ 18 | 19 | #define AIO_SERVER "io.adafruit.com" 20 | #define AIO_SERVERPORT 1883 // use 8883 for SSL 21 | #define AIO_USERNAME "iotdev" 22 | #define AIO_KEY "7cfc053140584a90af4cb13a769c9aed" 23 | 24 | /************ Global State (you don't need to change this!) ******************/ 25 | 26 | // Create an ESP8266 WiFiClient class to connect to the MQTT server. 27 | WiFiClient client; 28 | // or... use WiFiFlientSecure for SSL 29 | //WiFiClientSecure client; 30 | 31 | // Setup the MQTT client class by passing in the WiFi client and MQTT server and login details. 32 | Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_USERNAME, AIO_KEY); 33 | 34 | /****************************** Feeds ***************************************/ 35 | 36 | // Notice MQTT paths for AIO follow the form: /feeds/ 37 | Adafruit_MQTT_Subscribe light1 = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/light1"); 38 | Adafruit_MQTT_Subscribe light2 = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/light2"); 39 | Adafruit_MQTT_Subscribe light3 = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/light3"); 40 | Adafruit_MQTT_Subscribe light4 = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/light4"); 41 | 42 | /*************************** Sketch Code ************************************/ 43 | 44 | // Bug workaround for Arduino 1.6.6, it seems to need a function declaration 45 | // for some reason (only affects ESP8266, likely an arduino-builder bug). 46 | void MQTT_connect(); 47 | 48 | void setup() { 49 | pinMode(LIGHT_PIN1, OUTPUT); 50 | pinMode(LIGHT_PIN2, OUTPUT); 51 | pinMode(LIGHT_PIN3, OUTPUT); 52 | pinMode(LIGHT_PIN4, OUTPUT); 53 | 54 | 55 | Serial.begin(115200); 56 | delay(10); 57 | 58 | Serial.println(F("Adafruit MQTT demo")); 59 | 60 | // Connect to WiFi access point. 61 | Serial.println(); Serial.println(); 62 | Serial.print("Connecting to "); 63 | Serial.println(WLAN_SSID); 64 | 65 | WiFi.begin(WLAN_SSID, WLAN_PASS); 66 | while (WiFi.status() != WL_CONNECTED) { 67 | delay(500); 68 | Serial.print("."); 69 | } 70 | Serial.println(); 71 | 72 | Serial.println("WiFi connected"); 73 | Serial.println("IP address: "); Serial.println(WiFi.localIP()); 74 | 75 | // Setup MQTT subscription for onoff. 76 | mqtt.subscribe(&light1); 77 | mqtt.subscribe(&light2); 78 | mqtt.subscribe(&light3); 79 | mqtt.subscribe(&light4); 80 | } 81 | 82 | uint32_t x=0; 83 | 84 | void loop() { 85 | // Ensure the connection to the MQTT server is alive (this will make the first 86 | // connection and automatically reconnect when disconnected). See the MQTT_connect 87 | // function definition further below. 88 | MQTT_connect(); 89 | 90 | // this is our 'wait for incoming subscription packets' busy subloop 91 | // try to spend your time here 92 | 93 | Adafruit_MQTT_Subscribe *subscription; 94 | while ((subscription = mqtt.readSubscription(5000))) { 95 | 96 | 97 | // Check if its the onoff button feed Light1 98 | if (subscription == &light1) { 99 | Serial.print(F("On-Off button: ")); 100 | Serial.println((char *)light1.lastread); 101 | 102 | if (strcmp((char *)light1.lastread, "OFF") == 0) { 103 | digitalWrite(LIGHT_PIN1, LOW); 104 | } 105 | if (strcmp((char *)light1.lastread, "ON") == 0) { 106 | digitalWrite(LIGHT_PIN1, HIGH); 107 | } 108 | } 109 | 110 | // Check if its the onoff button feed Light2 111 | if (subscription == &light2) { 112 | Serial.print(F("On-Off button: ")); 113 | Serial.println((char *)light2.lastread); 114 | 115 | if (strcmp((char *)light2.lastread, "OFF") == 0) { 116 | digitalWrite(LIGHT_PIN2, LOW); 117 | } 118 | if (strcmp((char *)light2.lastread, "ON") == 0) { 119 | digitalWrite(LIGHT_PIN2, HIGH); 120 | } 121 | } 122 | 123 | // Check if its the onoff button feed Light3 124 | if (subscription == &light3) { 125 | Serial.print(F("On-Off button: ")); 126 | Serial.println((char *)light3.lastread); 127 | 128 | if (strcmp((char *)light3.lastread, "OFF") == 0) { 129 | digitalWrite(LIGHT_PIN3, LOW); 130 | } 131 | if (strcmp((char *)light3.lastread, "ON") == 0) { 132 | digitalWrite(LIGHT_PIN3, HIGH); 133 | } 134 | } 135 | 136 | // Check if its the onoff button feed Light4 137 | if (subscription == &light4) { 138 | Serial.print(F("On-Off button: ")); 139 | Serial.println((char *)light4.lastread); 140 | 141 | if (strcmp((char *)light4.lastread, "OFF") == 0) { 142 | digitalWrite(LIGHT_PIN4, LOW); 143 | } 144 | if (strcmp((char *)light4.lastread, "ON") == 0) { 145 | digitalWrite(LIGHT_PIN4, HIGH); 146 | } 147 | } 148 | 149 | } 150 | 151 | // ping the server to keep the mqtt connection alive 152 | if(! mqtt.ping()) { 153 | mqtt.disconnect(); 154 | } 155 | 156 | } 157 | 158 | // Function to connect and reconnect as necessary to the MQTT server. 159 | void MQTT_connect() { 160 | int8_t ret; 161 | 162 | // Stop if already connected. 163 | if (mqtt.connected()) { 164 | return; 165 | } 166 | 167 | Serial.print("Connecting to MQTT... "); 168 | 169 | uint8_t retries = 3; 170 | while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected 171 | Serial.println(mqtt.connectErrorString(ret)); 172 | Serial.println("Retrying MQTT connection in 5 seconds..."); 173 | mqtt.disconnect(); 174 | delay(5000); // wait 5 seconds 175 | retries--; 176 | if (retries == 0) { 177 | // basically die and wait for WDT to reset me 178 | while (1); 179 | } 180 | } 181 | Serial.println("MQTT Connected!"); 182 | } 183 | -------------------------------------------------------------------------------- /reyax_mqtt_cloud/code/publish1/publish1.ino: -------------------------------------------------------------------------------- 1 | #include "arduino_secrets.h" 2 | #include 3 | #include 4 | 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | WiFiClient wifiClient; 11 | MqttClient mqttClient(wifiClient); 12 | int count = 0; 13 | 14 | #define SCREEN_WIDTH 128 // OLED display width, in pixels 15 | #define SCREEN_HEIGHT 64 // OLED display height, in pixels 16 | 17 | // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) 18 | #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) 19 | Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); 20 | 21 | #define NUMFLAKES 10 // Number of snowflakes in the animation example 22 | 23 | #define LOGO_HEIGHT 16 24 | #define LOGO_WIDTH 16 25 | 26 | char rcvd_msg[32]; 27 | int msd_index; 28 | 29 | static const uint8_t image_data_Image[1024] = { 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 33 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 34 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 36 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x9c, 0x73, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x08, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x70, 0x00, 0x00, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7f, 0xfc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 54 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x70, 0x7f, 0xfc, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 55 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7f, 0xfc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x70, 0x7f, 0xfc, 0x1c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x70, 0x7f, 0xfc, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7f, 0xfc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x70, 0x00, 0x00, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x70, 0x00, 0x00, 0x1c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x7f, 0xdf, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x73, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 68 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 71 | 0x00, 0x00, 0x1f, 0xff, 0xf0, 0x00, 0x01, 0x00, 0x40, 0x00, 0x07, 0xf1, 0x60, 0x60, 0x00, 0x00, 72 | 0x00, 0x00, 0x10, 0x01, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x19, 0x30, 0xc0, 0x00, 0x00, 73 | 0x00, 0x00, 0x10, 0x01, 0x83, 0xf9, 0xfd, 0xfc, 0x4f, 0xe7, 0xf4, 0x0d, 0x19, 0x80, 0x00, 0x00, 74 | 0x00, 0x00, 0x10, 0x01, 0x82, 0x0b, 0x01, 0x06, 0x48, 0x20, 0x34, 0x0d, 0x09, 0x00, 0x00, 0x00, 75 | 0x00, 0x00, 0x1f, 0xe1, 0x87, 0xfb, 0x01, 0x06, 0x5f, 0xe0, 0xe4, 0x0d, 0x0f, 0x00, 0x00, 0x00, 76 | 0x00, 0x00, 0x00, 0x61, 0x86, 0x03, 0x01, 0x06, 0x58, 0x07, 0x04, 0x0d, 0x06, 0x00, 0x00, 0x00, 77 | 0x00, 0x00, 0x00, 0x61, 0x82, 0x03, 0x01, 0x06, 0x48, 0x0c, 0x04, 0x19, 0x06, 0x00, 0x00, 0x00, 78 | 0x00, 0x00, 0x1f, 0xe1, 0x83, 0xf9, 0xfd, 0x06, 0x4f, 0xef, 0xf7, 0xf1, 0x06, 0x00, 0x00, 0x00, 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 80 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 81 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 84 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 86 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 87 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 90 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 91 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 92 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 93 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 94 | }; 95 | 96 | void testdrawstyles(String str) { 97 | display.clearDisplay(); 98 | 99 | display.setTextSize(2); // Normal 1:1 pixel scale 100 | display.setTextColor(SSD1306_WHITE); // Draw white text 101 | display.setCursor(0,0); // Start at top-left corner 102 | // display.println(F("GSheet C2:")); 103 | // display.setCursor(0,1); // Start at top-left corner 104 | display.println(str.c_str()); 105 | display.display(); 106 | delay(2000); 107 | } 108 | 109 | void setup() { 110 | Serial.begin(9600); 111 | 112 | // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally 113 | if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64 114 | Serial.println(F("SSD1306 allocation failed")); 115 | for(;;); // Don't proceed, loop forever 116 | } 117 | display.clearDisplay(); 118 | display.drawBitmap(0, 0, image_data_Image, 128, 64, 1); 119 | display.display(); 120 | delay(2000); // Pause for 2 seconds 121 | display.clearDisplay(); 122 | 123 | 124 | WiFi.begin(WIFI_SSID, WIFI_PASS); 125 | while(WiFi.status() != WL_CONNECTED){ 126 | Serial.print("."); 127 | delay(500); 128 | } 129 | Serial.println("Connected to WiFi!"); 130 | mqttClient.setId(MQTT_CLID); 131 | mqttClient.setUsernamePassword(MQTT_USER, MQTT_PASS); 132 | if (!mqttClient.connect(MQTT_BROKER, MQTT_PORT)){ 133 | Serial.println(mqttClient.connectError()); 134 | } 135 | Serial.println("Connected to MQTT Cloud!"); 136 | testdrawstyles("STechiezDIY"); 137 | } 138 | 139 | 140 | void loop() { 141 | mqttClient.poll(); 142 | mqttClient.beginMessage(MQTT_TOPIC); 143 | mqttClient.print("Data = "); 144 | mqttClient.print(count); 145 | mqttClient.endMessage(); 146 | Serial.print("Sending: Data = "); 147 | Serial.println(count); 148 | testdrawstyles(String(count)); 149 | count++; 150 | delay(2000); 151 | } 152 | -------------------------------------------------------------------------------- /reyax_mqtt_cloud/code/subscribe1/subscribe1.ino: -------------------------------------------------------------------------------- 1 | #include "arduino_secrets.h" 2 | #include 3 | #include 4 | 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | WiFiClient wifiClient; 11 | MqttClient mqttClient(wifiClient); 12 | int count = 0; 13 | 14 | #define SCREEN_WIDTH 128 // OLED display width, in pixels 15 | #define SCREEN_HEIGHT 64 // OLED display height, in pixels 16 | 17 | // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) 18 | #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) 19 | Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); 20 | 21 | #define NUMFLAKES 10 // Number of snowflakes in the animation example 22 | 23 | #define LOGO_HEIGHT 16 24 | #define LOGO_WIDTH 16 25 | 26 | char rcvd_msg[32]; 27 | int msd_index; 28 | 29 | static const uint8_t image_data_Image[1024] = { 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 33 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 34 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 36 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x9c, 0x73, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x08, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x70, 0x00, 0x00, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7f, 0xfc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 54 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x70, 0x7f, 0xfc, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 55 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7f, 0xfc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x70, 0x7f, 0xfc, 0x1c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x70, 0x7f, 0xfc, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7f, 0xfc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x70, 0x00, 0x00, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x70, 0x00, 0x00, 0x1c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x7f, 0xdf, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x73, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 68 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 71 | 0x00, 0x00, 0x1f, 0xff, 0xf0, 0x00, 0x01, 0x00, 0x40, 0x00, 0x07, 0xf1, 0x60, 0x60, 0x00, 0x00, 72 | 0x00, 0x00, 0x10, 0x01, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x19, 0x30, 0xc0, 0x00, 0x00, 73 | 0x00, 0x00, 0x10, 0x01, 0x83, 0xf9, 0xfd, 0xfc, 0x4f, 0xe7, 0xf4, 0x0d, 0x19, 0x80, 0x00, 0x00, 74 | 0x00, 0x00, 0x10, 0x01, 0x82, 0x0b, 0x01, 0x06, 0x48, 0x20, 0x34, 0x0d, 0x09, 0x00, 0x00, 0x00, 75 | 0x00, 0x00, 0x1f, 0xe1, 0x87, 0xfb, 0x01, 0x06, 0x5f, 0xe0, 0xe4, 0x0d, 0x0f, 0x00, 0x00, 0x00, 76 | 0x00, 0x00, 0x00, 0x61, 0x86, 0x03, 0x01, 0x06, 0x58, 0x07, 0x04, 0x0d, 0x06, 0x00, 0x00, 0x00, 77 | 0x00, 0x00, 0x00, 0x61, 0x82, 0x03, 0x01, 0x06, 0x48, 0x0c, 0x04, 0x19, 0x06, 0x00, 0x00, 0x00, 78 | 0x00, 0x00, 0x1f, 0xe1, 0x83, 0xf9, 0xfd, 0x06, 0x4f, 0xef, 0xf7, 0xf1, 0x06, 0x00, 0x00, 0x00, 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 80 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 81 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 84 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 86 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 87 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 90 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 91 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 92 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 93 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 94 | }; 95 | 96 | void testdrawstyles(String str) { 97 | display.clearDisplay(); 98 | 99 | display.setTextSize(2); // Normal 1:1 pixel scale 100 | display.setTextColor(SSD1306_WHITE); // Draw white text 101 | display.setCursor(0,0); // Start at top-left corner 102 | // display.println(F("GSheet C2:")); 103 | // display.setCursor(0,1); // Start at top-left corner 104 | display.println(str.c_str()); 105 | display.display(); 106 | delay(2000); 107 | } 108 | 109 | void setup() { 110 | Serial.begin(9600); 111 | 112 | // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally 113 | if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64 114 | Serial.println(F("SSD1306 allocation failed")); 115 | for(;;); // Don't proceed, loop forever 116 | } 117 | display.clearDisplay(); 118 | display.drawBitmap(0, 0, image_data_Image, 128, 64, 1); 119 | display.display(); 120 | delay(2000); // Pause for 2 seconds 121 | display.clearDisplay(); 122 | 123 | 124 | WiFi.begin(WIFI_SSID, WIFI_PASS); 125 | while(WiFi.status() != WL_CONNECTED){ 126 | Serial.print("."); 127 | delay(500); 128 | } 129 | Serial.println("Connected to WiFi!"); 130 | mqttClient.setId(MQTT_CLID); 131 | mqttClient.setUsernamePassword(MQTT_USER, MQTT_PASS); 132 | if (!mqttClient.connect(MQTT_BROKER, MQTT_PORT)){ 133 | Serial.println(mqttClient.connectError()); 134 | } 135 | Serial.println("Connected to MQTT Cloud!"); 136 | mqttClient.subscribe(MQTT_TOPIC); 137 | testdrawstyles("STechiezDIY"); 138 | } 139 | 140 | 141 | void loop() { 142 | int messageSize = mqttClient.parseMessage(); 143 | msd_index = 0; 144 | memset(rcvd_msg,'\0',32); 145 | if (messageSize) { 146 | // we received a message, print out the topic and contents 147 | Serial.print("Received a message with topic '"); 148 | Serial.print(mqttClient.messageTopic()); 149 | Serial.print("', length "); 150 | Serial.print(messageSize); 151 | Serial.println(" bytes:"); 152 | 153 | // use the Stream interface to print the contents 154 | while (mqttClient.available()) { 155 | rcvd_msg[msd_index++] = (char)mqttClient.read(); 156 | } 157 | rcvd_msg[msd_index++] = '\0'; 158 | String message(rcvd_msg); 159 | Serial.println(message); 160 | testdrawstyles(message); 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /GoogleSpreadSheet_Read_OLED/arduino/esp32-googleSpreadSheetRead/esp32-googleSpreadSheetRead.ino: -------------------------------------------------------------------------------- 1 | /* Project : Read Google Spread Sheet Data from ESP32 */ 2 | /*Refer following video for complete project : https://youtu.be/0LoeaewIAdY*/ 3 | 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | /********************************************************************************/ 13 | //Things to change 14 | const char * ssid = "hidden"; 15 | const char * password = "password@021"; 16 | String GOOGLE_SCRIPT_ID = "AKfycbwiVWS6qx_iLStUexjCd4QBL2tey1nF3zbasZtbQZglKhZUYkaDLkydOCwS2pnfVA4f"; 17 | 18 | const int sendInterval = 5000; 19 | /********************************************************************************/ 20 | #define SCREEN_WIDTH 128 // OLED display width, in pixels 21 | #define SCREEN_HEIGHT 64 // OLED display height, in pixels 22 | 23 | // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) 24 | #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) 25 | Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); 26 | 27 | #define NUMFLAKES 10 // Number of snowflakes in the animation example 28 | 29 | #define LOGO_HEIGHT 16 30 | #define LOGO_WIDTH 16 31 | 32 | static const uint8_t image_data_Image[1024] = { 33 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 34 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 36 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x9c, 0x73, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x08, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 54 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x70, 0x00, 0x00, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 55 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7f, 0xfc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x70, 0x7f, 0xfc, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7f, 0xfc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x70, 0x7f, 0xfc, 0x1c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x70, 0x7f, 0xfc, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7f, 0xfc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x70, 0x00, 0x00, 0x1c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x70, 0x00, 0x00, 0x1c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x7f, 0xdf, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 68 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x73, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 72 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 74 | 0x00, 0x00, 0x1f, 0xff, 0xf0, 0x00, 0x01, 0x00, 0x40, 0x00, 0x07, 0xf1, 0x60, 0x60, 0x00, 0x00, 75 | 0x00, 0x00, 0x10, 0x01, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x19, 0x30, 0xc0, 0x00, 0x00, 76 | 0x00, 0x00, 0x10, 0x01, 0x83, 0xf9, 0xfd, 0xfc, 0x4f, 0xe7, 0xf4, 0x0d, 0x19, 0x80, 0x00, 0x00, 77 | 0x00, 0x00, 0x10, 0x01, 0x82, 0x0b, 0x01, 0x06, 0x48, 0x20, 0x34, 0x0d, 0x09, 0x00, 0x00, 0x00, 78 | 0x00, 0x00, 0x1f, 0xe1, 0x87, 0xfb, 0x01, 0x06, 0x5f, 0xe0, 0xe4, 0x0d, 0x0f, 0x00, 0x00, 0x00, 79 | 0x00, 0x00, 0x00, 0x61, 0x86, 0x03, 0x01, 0x06, 0x58, 0x07, 0x04, 0x0d, 0x06, 0x00, 0x00, 0x00, 80 | 0x00, 0x00, 0x00, 0x61, 0x82, 0x03, 0x01, 0x06, 0x48, 0x0c, 0x04, 0x19, 0x06, 0x00, 0x00, 0x00, 81 | 0x00, 0x00, 0x1f, 0xe1, 0x83, 0xf9, 0xfd, 0x06, 0x4f, 0xef, 0xf7, 0xf1, 0x06, 0x00, 0x00, 0x00, 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 84 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 86 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 87 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 90 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 91 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 92 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 93 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 94 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 95 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 96 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 97 | }; 98 | 99 | WiFiClientSecure client; 100 | 101 | void testdrawstyles(String str) { 102 | display.clearDisplay(); 103 | 104 | display.setTextSize(2); // Normal 1:1 pixel scale 105 | display.setTextColor(SSD1306_WHITE); // Draw white text 106 | display.setCursor(0,0); // Start at top-left corner 107 | // display.println(F("GSheet C2:")); 108 | // display.setCursor(0,1); // Start at top-left corner 109 | display.println(F(str.c_str())); 110 | display.display(); 111 | delay(2000); 112 | } 113 | 114 | void setup() { 115 | Serial.begin(115200); 116 | delay(10); 117 | 118 | // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally 119 | if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64 120 | Serial.println(F("SSD1306 allocation failed")); 121 | for(;;); // Don't proceed, loop forever 122 | } 123 | display.clearDisplay(); 124 | display.drawBitmap(0, 0, image_data_Image, 128, 64, 1); 125 | display.display(); 126 | delay(2000); // Pause for 2 seconds 127 | display.clearDisplay(); 128 | 129 | 130 | WiFi.mode(WIFI_STA); 131 | WiFi.begin(ssid, password); 132 | 133 | Serial.println("Started"); 134 | Serial.print("Connecting"); 135 | while (WiFi.status() != WL_CONNECTED) { 136 | delay(500); 137 | Serial.print("."); 138 | } 139 | 140 | Serial.println("Ready to go"); 141 | //testdrawstyles(); 142 | } 143 | 144 | void loop() { 145 | spreadsheet_comm(); 146 | delay(sendInterval); 147 | } 148 | 149 | void spreadsheet_comm(void) { 150 | HTTPClient http; 151 | String url="https://script.google.com/macros/s/"+GOOGLE_SCRIPT_ID+"/exec?read"; 152 | // Serial.print(url); 153 | Serial.print("Making a request"); 154 | http.begin(url.c_str()); //Specify the URL and certificate 155 | http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS); 156 | int httpCode = http.GET(); 157 | String payload; 158 | if (httpCode > 0) { //Check for the returning code 159 | payload = http.getString(); 160 | 161 | Serial.println(httpCode); 162 | Serial.println(payload); 163 | testdrawstyles(payload); 164 | } 165 | else { 166 | Serial.println("Error on HTTP request"); 167 | } 168 | http.end(); 169 | } 170 | -------------------------------------------------------------------------------- /Clock_NTP_ESP32/esp32-max7219-clock/Font_Data.h: -------------------------------------------------------------------------------- 1 | // Data file for user example user defined fonts 2 | #ifndef FONTDATA_H 3 | #define FONTDATA_H 4 | 5 | MD_MAX72XX::fontType_t numeric7Seg[] PROGMEM = 6 | { 7 | 0, // 0 8 | 0, // 1 9 | 0, // 2 10 | 0, // 3 11 | 0, // 4 12 | 0, // 5 13 | 0, // 6 14 | 0, // 7 15 | 0, // 8 16 | 0, // 9 17 | 0, // 10 18 | 0, // 11 19 | 0, // 12 20 | 0, // 13 21 | 0, // 14 22 | 0, // 15 23 | 0, // 16 24 | 0, // 17 25 | 0, // 18 26 | 0, // 19 27 | 0, // 20 28 | 0, // 21 29 | 0, // 22 30 | 0, // 23 31 | 0, // 24 32 | 0, // 25 33 | 0, // 26 34 | 0, // 27 35 | 0, // 28 36 | 0, // 29 37 | 0, // 30 38 | 0, // 31 39 | 1, 0, // 32 - 'Space' 40 | 0, // 33 - '!' 41 | 0, // 34 - '"' 42 | 0, // 35 - '#' 43 | 0, // 36 - '$' 44 | 0, // 37 - '%' 45 | 0, // 38 - '&' 46 | 0, // 39 - ''' 47 | 0, // 40 - '(' 48 | 0, // 41 - ')' 49 | 0, // 42 - '*' 50 | 0, // 43 - '+' 51 | 0, // 44 - ',' 52 | 0, // 45 - '-' 53 | 1, 64, // 46 - '.' 54 | 0, // 47 - '/' 55 | 3, 62, 34, 62, // 48 - '0' 56 | 3, 36, 62, 32, // 49 - '1' 57 | 3, 58, 42, 46, // 50 - '2' 58 | 3, 42, 42, 62, // 51 - '3' 59 | 3, 14, 8, 62, // 52 - '4' 60 | 3, 46, 42, 58, // 53 - '5' 61 | 3, 62, 42, 58, // 54 - '6' 62 | 3, 6, 2, 62, // 55 - '7' 63 | 3, 62, 42, 62, // 56 - '8' 64 | 3, 46, 42, 62, // 57 - '9' 65 | 1, 20, // 58 - ':' 66 | 0, // 59 - ';' 67 | 0, // 60 - '<' 68 | 0, // 61 - '=' 69 | 0, // 62 - '>' 70 | 0, // 63 - '?' 71 | 0, // 64 - '@' 72 | 5, 127, 9, 9, 9, 127, // 65 - 'A' 73 | 5, 127, 73, 73, 73, 54, // 66 - 'B' 74 | 5, 127, 65, 65, 65, 65, // 67 - 'C' 75 | 5, 127, 65, 65, 65, 62, // 68 - 'D' 76 | 5, 127, 73, 73, 73, 73, // 69 - 'E' 77 | 5, 127, 9, 9, 9, 9, // 70 - 'F' 78 | 0, // 71 - 'G' 79 | 0, // 72 - 'H' 80 | 0, // 73 - 'I' 81 | 0, // 74 - 'J' 82 | 0, // 75 - 'K' 83 | 0, // 76 - 'L' 84 | 0, // 77 - 'M' 85 | 0, // 78 - 'N' 86 | 0, // 79 - 'O' 87 | 0, // 80 - 'P' 88 | 0, // 81 - 'Q' 89 | 0, // 82 - 'R' 90 | 0, // 83 - 'S' 91 | 0, // 84 - 'T' 92 | 0, // 85 - 'U' 93 | 0, // 86 - 'V' 94 | 0, // 87 - 'W' 95 | 0, // 88 - 'X' 96 | 0, // 89 - 'Y' 97 | 0, // 90 - 'Z' 98 | 0, // 91 - '[' 99 | 0, // 92 - '\' 100 | 0, // 93 - ']' 101 | 0, // 94 - '^' 102 | 0, // 95 - '_' 103 | 0, // 96 - '`' 104 | 5, 127, 9, 9, 9, 127, // 97 - 'a' 105 | 5, 127, 73, 73, 73, 54, // 98 - 'b' 106 | 5, 127, 65, 65, 65, 65, // 99 - 'c' 107 | 5, 127, 65, 65, 65, 62, // 100 - 'd' 108 | 5, 127, 73, 73, 73, 73, // 101 - 'e' 109 | 5, 127, 9, 9, 9, 9, // 102 - 'f' 110 | 0, // 103 - 'g' 111 | 0, // 104 - 'h' 112 | 0, // 105 - 'i' 113 | 0, // 106 - 'j' 114 | 0, // 107 - 'k' 115 | 0, // 108 - 'l' 116 | 0, // 109 - 'm' 117 | 0, // 110 - 'n' 118 | 0, // 111 - 'o' 119 | 0, // 112 - 'p' 120 | 0, // 113 - 'q' 121 | 0, // 114 - 'r' 122 | 0, // 115 - 's' 123 | 0, // 116 - 't' 124 | 0, // 117 - 'u' 125 | 0, // 118 - 'v' 126 | 0, // 119 - 'w' 127 | 0, // 120 - 'x' 128 | 0, // 121 - 'y' 129 | 0, // 122 - 'z' 130 | 0, // 123 - '{' 131 | 1, 127, // 124 - '|' 132 | 0, // 125 133 | 0, // 126 134 | 0, // 127 135 | 0, // 128 136 | 0, // 129 137 | 0, // 130 138 | 0, // 131 139 | 0, // 132 140 | 0, // 133 141 | 0, // 134 142 | 0, // 135 143 | 0, // 136 144 | 0, // 137 145 | 0, // 138 146 | 0, // 139 147 | 0, // 140 148 | 0, // 141 149 | 0, // 142 150 | 0, // 143 151 | 0, // 144 152 | 0, // 145 153 | 0, // 146 154 | 0, // 147 155 | 0, // 148 156 | 0, // 149 157 | 0, // 150 158 | 0, // 151 159 | 0, // 152 160 | 0, // 153 161 | 0, // 154 162 | 0, // 155 163 | 0, // 156 164 | 0, // 157 165 | 0, // 158 166 | 0, // 159 167 | 0, // 160 168 | 0, // 161 169 | 0, // 162 170 | 0, // 163 171 | 0, // 164 172 | 0, // 165 173 | 0, // 166 174 | 0, // 167 175 | 0, // 168 176 | 0, // 169 177 | 0, // 170 178 | 0, // 171 179 | 0, // 172 180 | 0, // 173 181 | 0, // 174 182 | 0, // 175 183 | 0, // 176 184 | 0, // 177 185 | 0, // 178 186 | 0, // 179 187 | 0, // 180 188 | 0, // 181 189 | 0, // 182 190 | 0, // 183 191 | 0, // 184 192 | 0, // 185 193 | 0, // 186 194 | 0, // 187 195 | 0, // 188 196 | 0, // 189 197 | 0, // 190 198 | 0, // 191 199 | 0, // 192 200 | 0, // 193 201 | 0, // 194 202 | 0, // 195 203 | 0, // 196 204 | 0, // 197 205 | 0, // 198 206 | 0, // 199 207 | 0, // 200 208 | 0, // 201 209 | 0, // 202 210 | 0, // 203 211 | 0, // 204 212 | 0, // 205 213 | 0, // 206 214 | 0, // 207 215 | 0, // 208 216 | 0, // 209 217 | 0, // 210 218 | 0, // 211 219 | 0, // 212 220 | 0, // 213 221 | 0, // 214 222 | 0, // 215 223 | 0, // 216 224 | 0, // 217 225 | 0, // 218 226 | 0, // 219 227 | 0, // 220 228 | 0, // 221 229 | 0, // 222 230 | 0, // 223 231 | 0, // 224 232 | 0, // 225 233 | 0, // 226 234 | 0, // 227 235 | 0, // 228 236 | 0, // 229 237 | 0, // 230 238 | 0, // 231 239 | 0, // 232 240 | 0, // 233 241 | 0, // 234 242 | 0, // 235 243 | 0, // 236 244 | 0, // 237 245 | 0, // 238 246 | 0, // 239 247 | 0, // 240 248 | 0, // 241 249 | 0, // 242 250 | 0, // 243 251 | 0, // 244 252 | 0, // 245 253 | 0, // 246 254 | 0, // 247 255 | 0, // 248 256 | 0, // 249 257 | 0, // 250 258 | 0, // 251 259 | 0, // 252 260 | 0, // 253 261 | 0, // 254 262 | 0, // 255 263 | }; 264 | 265 | MD_MAX72XX::fontType_t numeric7Se[] PROGMEM = 266 | { 267 | 0, // 0 268 | 0, // 1 269 | 0, // 2 270 | 0, // 3 271 | 0, // 4 272 | 0, // 5 273 | 0, // 6 274 | 0, // 7 275 | 0, // 8 276 | 0, // 9 277 | 0, // 10 278 | 0, // 11 279 | 0, // 12 280 | 0, // 13 281 | 0, // 14 282 | 0, // 15 283 | 0, // 16 284 | 0, // 17 285 | 0, // 18 286 | 0, // 19 287 | 0, // 20 288 | 0, // 21 289 | 0, // 22 290 | 0, // 23 291 | 0, // 24 292 | 0, // 25 293 | 0, // 26 294 | 0, // 27 295 | 0, // 28 296 | 0, // 29 297 | 0, // 30 298 | 0, // 31 299 | 1, 0, // 32 - 'Space' 300 | 0, // 33 - '!' 301 | 0, // 34 - '"' 302 | 0, // 35 - '#' 303 | 0, // 36 - '$' 304 | 0, // 37 - '%' 305 | 0, // 38 - '&' 306 | 0, // 39 - ''' 307 | 0, // 40 - '(' 308 | 0, // 41 - ')' 309 | 0, // 42 - '*' 310 | 0, // 43 - '+' 311 | 0, // 44 - ',' 312 | 0, // 45 - '-' 313 | 1, 64, // 46 - '.' 314 | 0, // 47 - '/' 315 | 4, 127, 65, 65, 127, // 48 - '0' 316 | 4, 0, 66, 127, 64, // 49 - '1' 317 | 4, 121, 73, 73, 79, // 50 - '2' 318 | 4, 99, 73, 73, 119, // 51 - '3' 319 | 4, 15, 8, 8, 127, // 52 - '4' 320 | 4, 79, 73, 73, 121, // 53 - '5' 321 | 4, 127, 73, 73, 121, // 54 - '6' 322 | 4, 3, 1, 125, 3, // 55 - '7' 323 | 4, 119, 73, 73, 119, // 56 - '8' 324 | 4, 79, 73, 73, 127, // 57 - '9' 325 | 1, 20, // 58 - ':' 326 | 0, // 59 - ';' 327 | 0, // 60 - '<' 328 | 0, // 61 - '=' 329 | 0, // 62 - '>' 330 | 0, // 63 - '?' 331 | 0, // 64 - '@' 332 | 5, 127, 9, 9, 9, 127, // 65 - 'A' 333 | 5, 127, 73, 73, 73, 54, // 66 - 'B' 334 | 5, 127, 65, 65, 65, 65, // 67 - 'C' 335 | 5, 127, 65, 65, 65, 62, // 68 - 'D' 336 | 5, 127, 73, 73, 73, 73, // 69 - 'E' 337 | 5, 127, 9, 9, 9, 9, // 70 - 'F' 338 | 0, // 71 - 'G' 339 | 0, // 72 - 'H' 340 | 0, // 73 - 'I' 341 | 0, // 74 - 'J' 342 | 0, // 75 - 'K' 343 | 0, // 76 - 'L' 344 | 0, // 77 - 'M' 345 | 0, // 78 - 'N' 346 | 0, // 79 - 'O' 347 | 0, // 80 - 'P' 348 | 0, // 81 - 'Q' 349 | 0, // 82 - 'R' 350 | 0, // 83 - 'S' 351 | 0, // 84 - 'T' 352 | 0, // 85 - 'U' 353 | 0, // 86 - 'V' 354 | 0, // 87 - 'W' 355 | 0, // 88 - 'X' 356 | 0, // 89 - 'Y' 357 | 0, // 90 - 'Z' 358 | 0, // 91 - '[' 359 | 0, // 92 - '\' 360 | 0, // 93 - ']' 361 | 0, // 94 - '^' 362 | 0, // 95 - '_' 363 | 0, // 96 - '`' 364 | 5, 127, 9, 9, 9, 127, // 97 - 'a' 365 | 5, 127, 73, 73, 73, 54, // 98 - 'b' 366 | 5, 127, 65, 65, 65, 65, // 99 - 'c' 367 | 5, 127, 65, 65, 65, 62, // 100 - 'd' 368 | 5, 127, 73, 73, 73, 73, // 101 - 'e' 369 | 5, 127, 9, 9, 9, 9, // 102 - 'f' 370 | 0, // 103 - 'g' 371 | 0, // 104 - 'h' 372 | 0, // 105 - 'i' 373 | 0, // 106 - 'j' 374 | 0, // 107 - 'k' 375 | 0, // 108 - 'l' 376 | 0, // 109 - 'm' 377 | 0, // 110 - 'n' 378 | 0, // 111 - 'o' 379 | 0, // 112 - 'p' 380 | 0, // 113 - 'q' 381 | 0, // 114 - 'r' 382 | 0, // 115 - 's' 383 | 0, // 116 - 't' 384 | 0, // 117 - 'u' 385 | 0, // 118 - 'v' 386 | 0, // 119 - 'w' 387 | 0, // 120 - 'x' 388 | 0, // 121 - 'y' 389 | 0, // 122 - 'z' 390 | 0, // 123 - '{' 391 | 1, 127, // 124 - '|' 392 | 0, // 125 393 | 0, // 126 394 | 0, // 127 395 | 0, // 128 396 | 0, // 129 397 | 0, // 130 398 | 0, // 131 399 | 0, // 132 400 | 0, // 133 401 | 0, // 134 402 | 0, // 135 403 | 0, // 136 404 | 0, // 137 405 | 0, // 138 406 | 0, // 139 407 | 0, // 140 408 | 0, // 141 409 | 0, // 142 410 | 0, // 143 411 | 0, // 144 412 | 0, // 145 413 | 0, // 146 414 | 0, // 147 415 | 0, // 148 416 | 0, // 149 417 | 0, // 150 418 | 0, // 151 419 | 0, // 152 420 | 0, // 153 421 | 0, // 154 422 | 0, // 155 423 | 0, // 156 424 | 0, // 157 425 | 0, // 158 426 | 0, // 159 427 | 0, // 160 428 | 0, // 161 429 | 0, // 162 430 | 0, // 163 431 | 0, // 164 432 | 0, // 165 433 | 0, // 166 434 | 0, // 167 435 | 0, // 168 436 | 0, // 169 437 | 0, // 170 438 | 0, // 171 439 | 0, // 172 440 | 0, // 173 441 | 0, // 174 442 | 0, // 175 443 | 0, // 176 444 | 0, // 177 445 | 0, // 178 446 | 0, // 179 447 | 0, // 180 448 | 0, // 181 449 | 0, // 182 450 | 0, // 183 451 | 0, // 184 452 | 0, // 185 453 | 0, // 186 454 | 0, // 187 455 | 0, // 188 456 | 0, // 189 457 | 0, // 190 458 | 0, // 191 459 | 0, // 192 460 | 0, // 193 461 | 0, // 194 462 | 0, // 195 463 | 0, // 196 464 | 0, // 197 465 | 0, // 198 466 | 0, // 199 467 | 0, // 200 468 | 0, // 201 469 | 0, // 202 470 | 0, // 203 471 | 0, // 204 472 | 0, // 205 473 | 0, // 206 474 | 0, // 207 475 | 0, // 208 476 | 0, // 209 477 | 0, // 210 478 | 0, // 211 479 | 0, // 212 480 | 0, // 213 481 | 0, // 214 482 | 0, // 215 483 | 0, // 216 484 | 0, // 217 485 | 0, // 218 486 | 0, // 219 487 | 0, // 220 488 | 0, // 221 489 | 0, // 222 490 | 0, // 223 491 | 0, // 224 492 | 0, // 225 493 | 0, // 226 494 | 0, // 227 495 | 0, // 228 496 | 0, // 229 497 | 0, // 230 498 | 0, // 231 499 | 0, // 232 500 | 0, // 233 501 | 0, // 234 502 | 0, // 235 503 | 0, // 236 504 | 0, // 237 505 | 0, // 238 506 | 0, // 239 507 | 0, // 240 508 | 0, // 241 509 | 0, // 242 510 | 0, // 243 511 | 0, // 244 512 | 0, // 245 513 | 0, // 246 514 | 0, // 247 515 | 0, // 248 516 | 0, // 249 517 | 0, // 250 518 | 0, // 251 519 | 0, // 252 520 | 0, // 253 521 | 0, // 254 522 | 0, // 255 523 | }; 524 | #endif 525 | --------------------------------------------------------------------------------