Online community http://www.esp8266.com supporting all aspects of the ESP8266 and ESP8266EX
For more info see our wiki https://github.com/esp8266/esp8266-wiki/wiki
Check out the code examples in https://github.com/esp8266/source-code-examples
Examples of code for the ESP8266
Online community http://www.esp8266.com supporting all aspects of the ESP8266 and ESP8266EX
For more info see our wiki https://github.com/esp8266/esp8266-wiki/wiki
Check out the code examples in https://github.com/esp8266/source-code-examples
Hello,
I just try to compile small example
make!
Error ->
CC user/user_main.c
user/user_main.c: In function 'user_init':
user/user_main.c:51:5: error: passing argument 1 of 'ets_timer_disarm' discards 'volatile' qualifier from pointer target type [-Werror]
os_timer_disarm(&some_timer);
Googling ... -> Download espmissingincludes.h, mkdir include and add #include "espmissingincludes.h" in user_main.c
Ok run forward
CC user/user_main.c
In file included from user/user_main.c:2:0:
include/espmissingincludes.h:33:24: error: unknown type name 'os_timer_t'
void ets_timer_arm_new(os_timer_t *a, uint32_t b, bool repeat, bool isMstimer);
^
include/espmissingincludes.h:34:23: error: unknown type name 'os_timer_t'
void ets_timer_disarm(os_timer_t *a);
Google again ... -> change lib line in Makefile
LIBS = c gcc hal pp phy net80211 lwip wpa main pwm upgrade ssl crypto
os_timer_t is still unknown type/
Google again ... no result :(
Hi,
// loop function will be execute by "os" periodically
static void ICACHE_FLASH_ATTR loop(os_event_t *events)
which os FreeRTOS or another?
Please provide explicit licensing terms for the code in this repository.
Hi, I am using ESP8266 as my Access point and want to receive information from 2 remote arduino devices simultaneously. I am just able to get the information from one of those remote arduinos. My code at the access point is given as under:
`#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <WiFiUdp.h>
#include <TimeLib.h>
//These are the avariables you can change for your project. For example, change the SSID (network ID), change the ports on both machines.
//The most useful one is the LOOP_DELAY which changes how quicly it refreshes. set to 100ms be default.
char ssid[] = "ESPAP"; // your network SSID (name)
char password[] = "mPass@54321"; //Set the AP's password
unsigned int localPort = 2390; // local port to listen on
#define LOOP_DELAY 10 //how fast we check for new data
#define ARRAYSIZE 255 //size of message array (255bytes)
#define BAUD_RATE 115200 //serial comunication speed
//global variables
IPAddress remoteIp;
int remoteUDPPort;
char packetBuffer[ARRAYSIZE]; //buffer to hold incoming packet
int arraySize = ARRAYSIZE;
char inData[ARRAYSIZE]; // Allocate some space for the string
char inChar; // Where to store the character read
byte aindex = 0; // Index into array; where to store the character
boolean dataToSend = false;
WiFiUDP Udp;
void setup()
{
Serial.begin(BAUD_RATE);
/* You can remove the password parameter if you want the AP to be open. */
WiFi.softAP(ssid, password); //Start AP
// IPAddress myIP = WiFi.softAPIP(); if ever in doubt on this devices IP address you can get it here. Should be 192.168.4.1
Udp.begin(localPort);
WiFi.setSleepMode(WIFI_NONE_SLEEP);
}
void loop() {
while(Serial.available() > 0) //check for something to read from serial port
{
if(aindex < (arraySize-1)) // One less than the size of the array
{
inChar = Serial.read(); // Read a character
inData[aindex] = inChar; // Store it
aindex++; // Increment where to write next
inData[aindex] = '\0'; // Null terminate the string
}
dataToSend = true;
}
//check for incoming data via UDP
int packetSize = Udp.parsePacket();
if (packetSize)
{
remoteIp = Udp.remoteIP();
remoteUDPPort = Udp.remotePort();
int len = Udp.read(packetBuffer, 255); //read in the packet
if (len > 0)
{
packetBuffer[len] = 0;
}
Serial.println(packetBuffer);
}
// send UDP Data - this sends data to the last device it receives data from. For a one to one link this is fine. If there are multiple clients then this may need to be adjusted to store and send to all clients.
if(dataToSend)
{
if(Udp.beginPacket(remoteIp, remoteUDPPort))
{
Udp.write(inData);
Udp.endPacket();
//Serial.println(inData); //Uncomment this line for a local echo of the data sent
}
else
{
Serial.println("No connection");
}
dataToSend = false; //set the flag to false, ie only send when you need to.
for (aindex=0; aindex < arraySize; aindex++) //wipe the array
{
inData[aindex] = '\0'; // Null terminate the string
}
aindex = 0; //reset the index
}
}`
The information sent by remote devices are preceded by an identifier A01, B01. The information received from one remote device is :
B01 23.00 2384 916.35 5.14 0.000 5.00 -23.00
B01 23.00 2412 916.35 5.14 0.000 5.00 -23.00
B01 23.00 2466 916.35 5.15 0.000 5.00 -23.00
whereas i do not receive from A01. Kindly suggest. Many thanks
I built the basic_example (https://github.com/esp8266/source-code-examples.git) and simply put the following code at the beginning of user_init
uart_div_modify(0, UART_CLK_FREQ / 115200);
while (true) {
os_printf("Starting\n\r");
os_delay_us(1000000);
}
then considering that nodemcu v1.0 uses DIO for SPI flash, I modified the Makefile in two places:
- $(Q) $(ESPTOOL) elf2image -o $(FW_BASE)/ $(TARGET_OUT)
+ $(Q) $(ESPTOOL) elf2image --version=2 -o $(FW_BASE)/fw.bin $(TARGET_OUT)
in order to obtain a single bin and I added some options to esptool for loading:
- $(ESPTOOL) --port $(ESPPORT) write_flash $(FW_FILE_1_ADDR) $(FW_FILE_1) $(FW_FILE_2_ADDR) $(FW_FILE_2)
+ $(ESPTOOL) --port $(ESPPORT) write_flash -fm dio -fs 32m -ff 40m $(FW_FILE_ADDR) $(FW_BASE)/$(FW_FILE)
The program doesn't start up, I expected a periodic printing but I don't get anything.
I tried to load the nodemcu bin with the esptool command and I get a CHECK MEM FAIL even if it does work.
Hi
Is the loop method meant to be running along kind of like the arduino's main loop?
Ive tried modifying the basic example, adding some output but also increased the os_delay_us to not block the serial connection completely
#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"
#include "user_config.h"
#include "user_interface.h"
#define user_procTaskPrio 0
#define user_procTaskQueueLen 1
os_event_t user_procTaskQueue[user_procTaskQueueLen];
static void loop(os_event_t *events);
//Main code function
static void ICACHE_FLASH_ATTR
loop(os_event_t *events)
{
os_printf("loop\r\n");
os_delay_us(1000000);
}
//Init function
void ICACHE_FLASH_ATTR
user_init()
{
char ssid[32] = SSID;
char password[64] = SSID_PASSWORD;
struct station_config stationConf;
//Set station mode
wifi_set_opmode( 0x1 );
//Set ap settings
os_memcpy(&stationConf.ssid, ssid, 32);
os_memcpy(&stationConf.password, password, 32);
wifi_station_set_config(&stationConf);
//Start os task
system_os_task(loop, user_procTaskPrio,user_procTaskQueue, user_procTaskQueueLen);
os_printf("Prepped\r\n");
}
Ive only added the os_printf lines, it produces this on poweron:
ets Jan 8 2013,rst cause:1, boot mode:(3,7)
load 0x40100000, len 23156, room 16
tail 4
chksum 0xea
load 0x3ffe8000, len 2644, room 4
tail 0
chksum 0x4e
load 0x3ffe8a60, len 3352, room 8
tail 0
chksum 0x0c
csum 0x0c
Prepped
mode : sta(18:fe:34:99:23:db)
add if0
scandone
add 0
aid 3
pm open phy2,type:2 0 0
cnt
connected with xyz, channel 6
dhcp client start...
ip:192.168.1.5,mask:255.255.255.0,gw:192.168.1.1
Notice how it does print out Prepped
but not loop
, it does connect to wifi and responds to icmp ping requests just fine - but that loop method never seems to be called.
Normally we work with corporate or university wifi its hard to connect with those networks as they serve a captive portal I need to implement a solution for that
Hi buddies,
I successfully build toolchain in my raspberry.
I could build "blinky" example, but I had this error for the "dweet" example :
make
CC user/user_main.c
user/user_main.c:92:20: error: unknown type name 'System_Event_t'
void wifi_callback(System_Event_t *evt )
^
Any idea ?
Thank you
as the title says; the makefile contains hardcoded paths to some tools in some rbattles
user folder. This breaks the compilation for anyone else.
(thanks for your work btw!)
Blinky code wont work with 1.2ver sdk unless user_rf_pre_init is added.
I had some issues with the "make flash" command:
FIRST ONE:
After the make command it creates two files in a new driectory named firmware, thes two files are named '0x00000.bin' and '0x10000.bin', and nothing else !
However, while doing "make flash" command it says :
esptool.py --port /dev/ttyUSB0 /firmware/0x00000.bin 0x00000.bin /firmware/0x40000.bin 0x40000.bin
(...)
esp_tool write_flas : error: argument
I don't really know why it asks for a 0x40000.bin, this is a real bug.
I palliated this bug by typing manually the command :
esptool.py --port /dev/ttyUSB0 /firmware/0x00000.bin 0x00000.bin /firmware/0x10000.bin 0x10000.bin
and then the flashing worked with correctly an ESP-12E. But I think this solution is not perfect.
As in title lines 134 and 166.
In ordrer to install all of esp-open-rtos toolchain and and blinky code example I've approximatively followed this protocol here at https://www.penninkhof.com/2015/03/esp8266-open-sdk/#comment-698
When flashing with esptool.py it works very well with an ESP-12E but not with the same board and an ESP-12F instead.
Additionnal infos:
I've the same problem by using eclipse.
(I used both of Ubuntu and Debian, it didn't change anything)
Hi,
I've tried to edit the AT example, by adding the loop code given in the basic example.
Because the uart use task priorities 0 and 1, I've been trying to use USER_TASK_PRIO_2.
But the task seems to never be called. If i use USER_TASK_PRIO_0 the task is called, but as expected the uart don't work well.
Any idea ?
Hi.
Do you have any FOTA example with Unofficial Development Kit for Espressif ESP8266 ?
Best regards.
I had an issue , while trying to do flash
Cannot open /dev/ttyUSB0: Permission denied
https://bugs.launchpad.net/ubuntu/+source/gtkterm/+bug/949597
I palliated to this problem with the command " sudo chmod -R 777 /dev/ttyUSB0 " each time I wanted to flash.
Do you know more about these bugs ? This maybe due to an ubuntu bug (Ubuntu 16 LTS) but I don't know
Can somebody please merge the pull requests?
They would have been quite helpful for me, because the new Makefile does only rely on esptool.py.
This could have saved me some hours of searching.
Thanks!
I'll preface this with the fact that I haven't worked with the ESP8266 SDK for very long but when I was messing around with the Blinky code example, I got it working just fine without system_os_task() and all the user_procTask variables and functions that go with it. I know that those come in handy for adding functionality down the road but if this is supposed to be a barebones example, why include all that cruft?
I added some of the enterprise functions to the basic_example and linked with wpa2, but I'm getting what sounds like an out of memory error even with this minimal program. This is with ESP8266_NONOS_SDK_V2.0.0_16_08_10, any ideas? I have the same error if I try a PEM client certificate and private key.
wifi_set_opmode(STATION_MODE);
wifi_station_set_wpa2_enterprise_auth(true);
wifi_station_set_reconnect_policy(false);
wifi_station_set_enterprise_username((u8*)EAP_USER, os_strlen(EAP_USER));
wifi_station_set_enterprise_password((u8*)EAP_PASSWORD, os_strlen(EAP_PASSWORD));
wifi_station_connect();
heap 46040 wifi status 1
state: 2 -> 0 (0)
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt
Method private structure allocated failure
Full program here.
https://github.com/dfries/source-code-examples/blob/wpa2-eap/basic_example/user/user_main.c
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.