GithubHelp home page GithubHelp logo

seco / esp8266-arduino Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sharpcoder/esp8266-arduino

0.0 1.0 0.0 10 KB

An arduino library for doing basic HTTP commands with the ESP8266 chip

License: MIT License

C++ 86.52% Arduino 11.23% C 2.25%

esp8266-arduino's Introduction

esp8266-arduino

An arduino library for doing basic HTTP commands with the ESP8266 chip.

Currently, my library only supports /GET. However, that should change soon as I need to actually make a POST request for my project. I wanted to get this open source library up though, as an example for how to use the ESP8266 module with the arduino. Specifically wrt making http requests. Which is probably what most people use it for.

The only (admittedly big) missing feature here is actually ip-address lookup. You'll have to hard-code an ip address which you want to access.

Pay little attention to the god awful string management library I wrote. It's there so you can dynamically adjust the message and do cool things with headers. But really, it's not going to work for long because it's a resource hog.

Supported protocols

  • GET
  • POST
  • All of then, in theory

You can set the "method" on your request now.

Using this library

You will need to go into the main.ino file, update the HttpMessage object and supply your own constants for NETWORK_NAME_HERE and NETWORK_PASSWORD_HERE.

I have added my own kind of Serial.readStringUntil() method because the default one that arduino provides wasn't cutting it for me. It has some retry logic and seems to work pretty well for my purposes. You may find the timeout needs to be tweaked a bit. If you get a lot of "Error condition has been met" messages, that's probably why.

To support dynamic message bodies and headers and stuff, I had to bust out a custom string allocation engine. It's not very pretty and I promise I'll fix it some day... So don't worry too much about the StringUtils stuff. I just wanted to put up a working example of how to efficiently send dynamic messages, because that's a real-world scenario.

esp8266-arduino's People

Contributors

sharpcoder 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.