Giter Site home page Giter Site logo

gianrisa / espbase Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pedroalbuquerque/espbase

0.0 1.0 0.0 49 KB

Base set of funcionalities usefull for almost any project built over ESP

License: GNU General Public License v3.0

C++ 20.28% C 79.72%

espbase's Introduction

ESPBASE lib

library to build ESP8266/ESP32 projects using OTA and Web config

This lib was created to simplify the creation of any new project from scratch but starting with many Wifi and Web functionalities already available to be used in code with minimum configuration effort.

Some basic functionalities are provided:

  • OTA (Over The Air) programming or wireless upload of code as an alternative to Serial upload
  • EEPROM saved configuration to allow the board to connect to your access point when booting
  • Web configuration page to allow changing the EEPROM saved configuration
  • AP (Access Point) boot when connection to your access point does not succeed
  • NTP to allow you to have a variable with current date and time loaded from internet

How to use it

Download all the files from this folder to a folder on your /libraries folder .

For a brand new board/sketch you have to start from the example/WiFi_CFG_OTA_Telnet/WiFi_CFG_OTA_Telnet.ino and load this sketch using a serial port upload via an FTDI ou USB interface. You should copy the example/WiFi_CFG_OTA_Telnet to your own projects/ folder and rename it accordingly.

Once loaded, the sketch will try to load configuration from EEPROM(flash) (nothing will be saved when loaded for the first time), and if no configuration is found, board will enter in AP mode. In this mode a new AP will be available for you to connect your PC or Mobile phone, with the name "ESP8266-xxxx" or "ESP32-xxxx" and no password. The board will be assigned the IP:192.168.4.1. Once you connect your PC or phone to this AP("ESP8266-xxxx" or "ESP32-xxxx"), you can open a browser and try to access the IP address 192.168.4.1, that will show you the main configuration page Choose "Network Configuration button" to define SSID and Password so the board can connect to your home Access point(router) and use the "Save" button to save it to the EEPROM. Board will reset and connect to your router acquiring a new IP address on your lan network. On your Serial Monitor you can see what is the board new IP address assigned by your router and you can now connect to the board via this new IP. To do so now you have to reconnect your PC or phone to your home router.

You can test it by using a "ping" command from a command line on your PC or Terminal if on a MAC.

If you succeed, a new port should show up (may take a 1 to 3 minutes to show up) in your Arduino IDE environment to allow to OTA your next sketch to the board.

How to write your own code

Assuming you are familiar with the Arduino framework, you have the same two basic function setup() and loop(), that already have some basic code to implement this basic functionality of the template. you can find in this to function a place holder like

//**** Normal Sketch code here...

  write you own setup code after this comment

You can naturally include your libraries in the sketch as necessary for your specific code.

External Dependencies (not builtin to framework)

External dependencies are a set of libraries that need to be installed (if you use Arduino IDE), or referenced in platformio.ini in case you use Platformio

ESP8266

To used this library with ESP8266 not additional libraries are needed (that I can remember, as i have created it for some time now).

ESP32

To use with ESP32 this is a bit more demanding to prepare the environment. Assuming ESP 32 environment has already been installed you will need:

Hope you can find this interesting and useful.

Pedro Albuquerque

espbase's People

Contributors

pedroalbuquerque avatar stritti avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.