marcoschwartz / arest-esp8266 Goto Github PK
View Code? Open in Web Editor NEWaREST API for the ESP8266 WiFi chip using the NodeMCU firmware
aREST API for the ESP8266 WiFi chip using the NodeMCU firmware
Hello.
first i want to say u did a great job here! keep on!
everytime i unplug my esp8266 for a power source i need to set the mode.
(http://192.168.1.9/mode/2/o)
the i can control the GPIO.
is it possible to set the mode right from the Arduino IDE sketch?
thank you!
#include <ESP8266WiFi.h>
#include <aREST.h>
// Create aREST instance
aREST rest = aREST();
// WiFi parameters
const char* ssid = "wifi_name";
const char* password = "password";
//#define LISTEN_PORT 80
WiFiServer server(88);
//udf
int testFunction(String value){
Serial.println("Received rest request");
}
void setup(void) {
// put your setup code here, to run once:
Serial.begin(115200);
rest.function("test", testFunction);
// Give name & ID to the device (ID should be 6 characters long)
rest.set_id("1");
rest.set_name("esp8266");
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(700);
Serial.print(".");
Serial.print(WiFi.status());
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin(115200);
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
// put your main code here, to run repeatedly:
// Handle REST calls
WiFiClient client = server.available();
if (!client) {
return;
}
while(!client.available()){
delay(1);
}
rest.handle(client);
}
code Gets compiled and uploaded but when i try to access the ip address of the board in a browser its shows
"This site canβt be reached #ipaddres# refused to connect".
and there is no output in a serial monitor
When I open a terminal and run dofile("basic.lua") it works okay but I want to have it start on boot so I created init.lua with only the dofile. With that I get a not enough memory error related to aREST.lua. I didn't have this problem at all on my other esp loaded with nodemcu 0.9.5.
Hi,
I've tried to put the aREST.lua and the basic.lua file on my esp8266. With the last NodeMCU firmware released. This is the error i'm getting:
lua: error loading module 'aREST' from file 'aREST.lua':
not enough memory
How to deal with it?
Project should really be named something like...
aREST-nodeMCU
or
luaREST
π
The issue I have is that
esp8266 β nodeMCU
whereas
nodeMCU β lua
Thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.