Coder Social home page Coder Social logo

esp8266 / arduino Goto Github PK

View Code? Open in Web Editor NEW
15.8K 15.8K 13.3K 224.83 MB

ESP8266 core for Arduino

License: GNU Lesser General Public License v2.1

Shell 0.73% C 32.74% C++ 61.46% Makefile 0.31% Assembly 0.33% HTML 0.88% Python 3.54% CSS 0.01%

arduino's Introduction

Arduino core for ESP8266 WiFi chip

Quick links

Arduino on ESP8266

This project brings support for the ESP8266 chip to the Arduino environment. It lets you write sketches, using familiar Arduino functions and libraries, and run them directly on ESP8266, with no external microcontroller required.

ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA updates, use a file system in flash memory, and work with SD cards, servos, SPI and I2C peripherals.

Contents

Installing with Boards Manager

Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).

  • Download and install Arduino IDE 1.x or 2.x
  • Start Arduino and open the Preferences window
  • Enter https://arduino.esp8266.com/stable/package_esp8266com_index.json into the File>Preferences>Additional Boards Manager URLs field of the Arduino IDE. You can add multiple URLs, separating them with commas.
  • Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).

Latest release Latest release

Boards manager link: https://arduino.esp8266.com/stable/package_esp8266com_index.json

Documentation: https://arduino-esp8266.readthedocs.io/en/3.1.2/

Using git version

Also known as latest git or master branch.

Using PlatformIO

PlatformIO is an open source ecosystem for IoT development with a cross-platform build system, a library manager, and full support for Espressif (ESP8266) development. It works on the following popular host operating systems: macOS, Windows, Linux 32/64, and Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).

Building with make

makeEspArduino is a generic makefile for any ESP8266 Arduino project. Using make instead of the Arduino IDE makes it easier to do automated and production builds.

Documentation

Documentation for latest development version: https://arduino-esp8266.readthedocs.io/en/latest/

Issues and support

ESP8266 Community Forum is a well-established community for questions and answers about Arduino for ESP8266. Stackoverflow is also an alternative. If you need help, have a "How do I..." type question, have a problem with a 3rd party library not hosted in this repo, or just want to discuss how to approach a problem, please ask there.

If you find the forum useful, please consider supporting it with a donation.
Donate

If you encounter an issue which you think is a bug in the ESP8266 Arduino Core or the associated libraries, or if you want to propose an enhancement, you are welcome to submit it here on Github: https://github.com/esp8266/Arduino/issues.

Please provide as much context as possible, as well as the information requested in the issue template:

  • ESP8266 Arduino core version which you are using (you can check it in Boards Manager)
  • your sketch code; please wrap it into a code block, see Github markdown manual
  • when encountering an issue that happens at run time, attach the serial output. Wrap it into a code block, just like the code.
  • for issues that happen at compile time, enable verbose compiler output in the IDE preferences, and attach that output (also inside a code block)
  • ESP8266 development board model
  • IDE settings (board choice, flash size)
  • etc

Contributing

For minor fixes of code and documentation, please go ahead and submit a pull request. A gentle introduction to the process can be found here.

Check out the list of issues that are easy to fix โ€” easy issues pending. Working on them is a great way to move the project forward.

Larger changes (rewriting parts of existing code from scratch, adding new functions to the core, adding new libraries) should generally be discussed by opening an issue first. PRs with such changes require testing and approval.

Feature branches with lots of small commits (especially titled "oops", "fix typo", "forgot to add file", etc.) should be squashed before opening a pull request. At the same time, please refrain from putting multiple unrelated changes into a single pull request.

License and credits

Arduino IDE is developed and maintained by the Arduino team. The IDE is licensed under GPL.

ESP8266 core includes an xtensa gcc toolchain, which is also under GPL.

Esptool.py was initially created by Fredrik Ahlberg (@themadinventor, @kongo), and is currently maintained by Angus Gratton (@projectgus) under GPL 2.0 license.

Espressif's NONOS SDK included in this build is under Espressif MIT License.

ESP8266 core files are licensed under LGPL.

SPI Flash File System (SPIFFS) written by Peter Andersson is used in this project. It is distributed under the MIT license.

umm_malloc memory management library written by Ralph Hempel is used in this project. It is distributed under the MIT license.

SoftwareSerial library and examples written by Peter Lerup. Distributed under LGPL 2.1.

BearSSL library written by Thomas Pornin, built from https://github.com/earlephilhower/bearssl-esp8266, is used in this project. It is distributed under the MIT License.

LittleFS library written by ARM Limited and released under the BSD 3-clause license.

uzlib library written and (c) 2014-2018 Paul Sokolovsky, licensed under the ZLib license (https://www.zlib.net/zlib_license.html). uzlib is based on: tinf library by Joergen Ibsen (Deflate decompression); Deflate Static Huffman tree routines by Simon Tatham; LZ77 compressor by Paul Sokolovsky; with library integrated and maintained by Paul Sokolovsky.

Other useful links

Toolchain repo

Lwip link layer repo

SoftwareSerial repo

Serial Monitor Arduino IDE plugin Original discussion here, quick download there.

FTP Client/Server Library

arduino's People

Contributors

aerlon avatar alltheblinkythings avatar d-a-v avatar devyte avatar dirkmueller avatar dok-net avatar earlephilhower avatar erriez avatar everslick avatar h4rm0n1c avatar hallard avatar hreintke avatar igrr avatar ivankravets avatar jandrassy avatar krzychb avatar kzyapkov avatar liebman avatar links2004 avatar lrmoreno007 avatar makuna avatar martinayotte avatar mcspr avatar me-no-dev avatar mhightower83 avatar narongrat avatar paulocsanz avatar pgollor avatar probonopd avatar wemos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino's Issues

ESP8266WiFiClass::begin Starts in STA + AP mode?

is there a reason for starting in WIFI_AP_STA mode?
in the default config the AP is "open" (no WPA2, no password), this can be a big risk of the security for the application or the network.

int ESP8266WiFiClass::begin(const char* ssid, const char *passphrase)
{
    if (wifi_get_opmode() == WIFI_AP)
    {
        // turn on AP+STA mode
        mode(WIFI_AP_STA);
    }

i preferred to only open the AP if the user really need it.

 mode(WIFI_STA);

Latest windows version 1.6.1-p1.zip doesn't seem to compile

There seems to be some sort of compiler build issue in the latest windows zip.

You just get a message saving Error compiling

But if you look at the verbose output and cut and paste it into the Windows command line, and run it, the error is that the xtensia gcc compilor can't locate libiconv-2.dll

Update to latest SDK

Used version is 0.9.5

Latest SDK version is esp_iot_sdk_v1.0.0_15_03_20 released

Fix bugs:

  • Interrupt during flash erasing will cause wdt reset
  • Read/write rtc memory
  • If router disconnect to ESP8266, ESP8266 wonโ€™t reconnect
  • Connect to router which hid its SSID

Full Changelog & Download:
http://bbs.espressif.com/viewtopic.php?f=5&t=286

Some Naming and Cosmetic Change Offers

To visually match the Arduino IDE naming conventions and general ESP8266 naming here are my suggestions:

platform.txt:

As in ESP8266 world boards are called as modules, so name should include the word "Modules"

name=Arduino ESP8266 Modules

programmers.txt:

In Arduino IDE all programmer names start with capital letter so captalizing ESPTool should look good
esptool.name=ESPTool

boards.txt

As there are several modules esp01.xxx definitions should be converted to generic.xxx and esp01 in variants directory should be renamed accordingly.

Variant names should include Module as above and esp01's replaced by generic elsewhere

generic.name=Generic ESP8266 Module
generic.build.board=ESP8266_GENERIC
generic.build.variant=generic

wifio.name=WIFIO Module

itoa() function not found

I have a sketch that uses the itoa() function, and I got the error when compiling:

'itoa' was not declared in this scope

Is this function already included in the project? Thanks!

Issue with float values/calculation

The calculations with floats doesnt work. It averages to integer.
float i;
i = 5/2;

I have hooked up oled display and when I print the value, it shows just 2.00. First, I thought it may be just problem with display, so I get it to send the value back over serial but I got 2.0000000000 too.

Adding the custom libraries

Hello, would it be possible to add a SimpleTimer? I am not sure, how it should work, but to be able to find e.g. SimpleTimer, I have to copy the .h and .cpp file to the arduino-1.6.1\hardware\esp8266com\esp8266\cores\esp8266. I have tried to copy is to the C:\RH\arduino-1.6.1\libraries\ but it didn't worked. BTW this library works well and could be used without any change.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

_DSO_HANDLE isn't defined

When I tried to use the original PubSub I got a message to say _dso_handle isn't defined.

This time I've tried a simple web server page - using nothing special and the compilation has come back with the same error..

C:\Users\Peter\AppData\Local\Temp\build71807972327932918.tmp/WiFiWebServer.cpp.elf: hidden symbol `__dso_handle' isn't defined

I used the same startup code as the server example that comes with this package - but this main loop

void loop(){
// Create a client connection
WiFiClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();

    //read char by char HTTP request
    if (readString.length() < 100) {

      //store characters to string 
      readString += c; 
      //Serial.print(c);
    } 

    //if HTTP request has ended
    if (c == '\n') {

      ///////////////
      Serial.println(readString); //print to serial monitor for debuging 

      client.println("HTTP/1.1 200 OK"); //send new page
      client.println("Content-Type: text/html");
      client.println();

      client.println("<HTML>");
      client.println("<HEAD>");
      client.println("<TITLE>Arduino GET test page</TITLE>");
      client.println("</HEAD>");
      client.println("<BODY>");

      client.println("<H1>Zoomkat's simple Arduino button</H1>");

      // DIY buttons
      client.println("<a href=\"/?on\"\">ON</a>"); 
      client.println("<a href=\"/?off\"\">OFF</a><br />"); 

      // mousedown buttons
      client.println("<br><input type=\"button\" value=\"ON\" onmousedown=\"location.href ('/?on');\"/>"); 
      client.println("<input type=\"button\" value=\"OFF\" onmousedown=\"location.href ('/?off');\"/>");        

      // mousedown radio buttons
      client.println("<br><br><input type=\"radio\" value=\"ON\" onmousedown=\"location.href ('/?on');\"\">ON</>"); 
      client.println("<input type=\"radio\" value=\"OFF\" onmousedown=\"location.href ('/?off');\"\">OFF</>");        

      client.println("</BODY>");
      client.println("</HTML>");

      delay(1);
      //stopping client
      client.stop();

      ///////////////////// control arduino pin
      if(readString.indexOf("on") >0)//checks for on
      {

        digitalWrite(0, HIGH);    // set pin 5 high
        Serial.println("Led On");
      }
      if(readString.indexOf("off") >0)//checks for off
      {
        digitalWrite(0, LOW);    // set pin 5 low
        Serial.println("Led Off");
      }
      //clearing string for next read
      readString="";

    }
  }
}

}
}

ESP hangs up

Iยดm trying to build a wireless PIR sensor from a ESP-07.
I have the code already working but after a undefined time the firmware hangs up and logs some unusual stuff on the UART.
The IDE Iยดve used is built by myself and is the most actual version fresh from the esp8266 branch.

The Sketch:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>

const int pirPin = 2;
const char* ssid = "Home 7362";
const char* password = "mysecretpasswordwhichnobodyshouldknowxDD";
const char* host = "192.168.178.24";
const int port = 80;
int lastMillis;
bool lastState;
WiFiClient wifiClient;

void pirInterrupt();

void setup() {
  Serial.begin(9600);

  WiFi.begin(ssid, password);
  Serial.println("");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  pinMode(2, INPUT);
  //attachInterrupt(2, pirInterrupt, FALLING);
  lastMillis = millis();

  while(digitalRead(pirPin) == LOW){
    Serial.println("Calibrating...");
    delay(200);
  }

}

void loop() {
  if(digitalRead(pirPin) == HIGH && lastState == LOW && millis() - lastMillis >= 5000){
      pirInterrupt();
    lastMillis = millis();
  }
  lastState = digitalRead(pirPin);

  delay(20);
}

void pirInterrupt() {
  Serial.println("PIR: alarm triggered!");

  if (!wifiClient.connect(host, 80)) {
    Serial.println("Connection failed!");
    return;
  }

  String url = "/pirpush/push.php";
  url += "?message=Der+Postmann+ist+da!";
  url+= "&id=1";

  Serial.print("Requesting URL: "); 
  Serial.println(url);

  wifiClient.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");
  /*
  delay(50);

  while(wifiClient.available()){
    String line = wifiClient.readStringUntil('\r');
    Serial.print(line);
  }
  */
  Serial.println();
  Serial.println("Closing connection.");
}

The output on serial:
bildschirmfoto 2015-04-04 um 18 29 21

What is the issue with it?

Floating Point Conversions

I need to convert numbers entered in a browser (Strings) or sent by MQTT (char array) to a floating point number (double).

I've been trying and failing various ways, but I'm pretty new to C (only since i got hold of the beta for this) so i've failed.

Igrr has said that atof has not been implemented ... this is what is in core_esp8266_noniso.c

float atof_internal(const char* s)
{
  float result = 0;
  return result;
}

atol does work but I'd kinda like the decimals... ( i know i can just enter an integer and then divide...)

Does anyone have any ideas... or fancy giving me a quick patch for this.. I'd try.... infact i spent a few hours on it.. but I'm so new to arrays, pointers, and all this that i just fail....

Cheers

A

Can't use os_printf in user-defined library?

I created a library, but I can't use os_print in my code, anything instead?

: error: 'os_printf_plus' was not declared in this scope
     os_printf("\n\n");
                     ^

here is my header

#include "ets_sys.h"
#include "c_types.h"
#include "osapi.h"
#include "user_interface.h"

DTR not firing

In the Eclipse environment, the DTR line drops momentarily (about half a second) before programming commenses - this allows third party hardware to pull down GPIO0 and reset automatically - to make programming similar to programming Arduinos - yet in this environment, that does not happen. Is there any way to add this in?

add support for "serial1" (TX only)

TX is working RX is disabled (only posible on GPIO 8 but we have no access to it)

in HardwareSerial.cpp in uart0_interrupt_handler add:

    status = READ_PERI_REG(UART_INT_ST(1));
    if (status & UART_TXFIFO_EMPTY_INT_ST)
    {
        WRITE_PERI_REG(UART_INT_CLR(1), UART_TXFIFO_EMPTY_INT_CLR);
        Serial1._tx_empty_irq();
    }

HardwareSerial1.cpp

/* 
  HardwareSerial1.cpp - esp8266 UART support

  Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
  This file is part of the esp8266 core for Arduino environment.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

  Modified 30 March 2015 by Markus Sattler (esp8266 platform support for UART1)
*/


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "Arduino.h"
#include "cbuf.h"

extern "C" {
#include "osapi.h"
#include "ets_sys.h"
#include "mem.h"
#include "uart_register.h"
#include "user_interface.h"
}

#include "HardwareSerial1.h"

HardwareSerial1 Serial1;

uart_t* uart1_init(int baud_rate);
void uart1_set_baudrate(uart_t* uart, int baud_rate);
int  uart1_get_baudrate(uart_t* uart);
void uart1_uninit(uart_t* uart);
void uart1_transmit(uart_t* uart, const char* buf, size_t size);    // may block on TX fifo
void uart1_wait_for_transmit(uart_t* uart);
void uart1_transmit_char(uart_t* uart, char c);  // does not block, but character will be lost if FIFO is full

void uart1_set_debug(bool enabled);
bool uart1_get_debug();

struct uart_
{
    int  baud_rate;
};

#define UART_TX_FIFO_SIZE 0x80
/*
void ICACHE_FLASH_ATTR uart1_interrupt_handler(uart_t* uart)
{
    uint32_t status = READ_PERI_REG(UART_INT_ST(1));
    if (status & UART_RXFIFO_FULL_INT_ST)
    {
        while(true)
        {
            int rx_count = (READ_PERI_REG(UART_STATUS(1)) >> UART_RXFIFO_CNT_S) & UART_RXFIFO_CNT;
            if (!rx_count)
                break;

            while(rx_count--)
            {
                char c = READ_PERI_REG(UART_FIFO(1)) & 0xFF;
                Serial1._rx_complete_irq(c);
            }
        }
        WRITE_PERI_REG(UART_INT_CLR(1), UART_RXFIFO_FULL_INT_CLR);
    }

    if (status & UART_TXFIFO_EMPTY_INT_ST)
    {
        WRITE_PERI_REG(UART_INT_CLR(1), UART_TXFIFO_EMPTY_INT_CLR);
        Serial1._tx_empty_irq();
    }
}
*/
void ICACHE_FLASH_ATTR uart1_wait_for_tx_fifo(size_t size_needed)
{
    while (true)
    {
        size_t tx_count = (READ_PERI_REG(UART_STATUS(1)) >> UART_TXFIFO_CNT_S) & UART_TXFIFO_CNT;
        if (tx_count <= (UART_TX_FIFO_SIZE - size_needed))
            break;
    }
}

size_t ICACHE_FLASH_ATTR uart1_get_tx_fifo_room()
{
    return UART_TX_FIFO_SIZE - ((READ_PERI_REG(UART_STATUS(1)) >> UART_TXFIFO_CNT_S) & UART_TXFIFO_CNT);
}

void ICACHE_FLASH_ATTR uart1_wait_for_transmit(uart_t* uart)
{
    uart1_wait_for_tx_fifo(UART_TX_FIFO_SIZE);
}

void ICACHE_FLASH_ATTR uart1_transmit_char(uart_t* uart, char c)
{
    WRITE_PERI_REG(UART_FIFO(1), c);
}

void ICACHE_FLASH_ATTR uart1_transmit(uart_t* uart, const char* buf, size_t size)
{
    while (size)
    {
        size_t part_size = (size > UART_TX_FIFO_SIZE) ? UART_TX_FIFO_SIZE : size;
        size -= part_size;

        uart1_wait_for_tx_fifo(part_size);
        for(;part_size;--part_size, ++buf)
            WRITE_PERI_REG(UART_FIFO(1), *buf);
    }
}

void ICACHE_FLASH_ATTR uart1_flush(uart_t* uart)
{
    SET_PERI_REG_MASK(UART_CONF0(1),  UART_TXFIFO_RST);  // UART_RXFIFO_RST |
    CLEAR_PERI_REG_MASK(UART_CONF0(1), UART_TXFIFO_RST); // UART_RXFIFO_RST |
}

void ICACHE_FLASH_ATTR uart1_interrupt_enable(uart_t* uart)
{
//    WRITE_PERI_REG(UART_INT_CLR(0), 0x1ff);
//    ETS_UART_INTR_ATTACH(&uart1_interrupt_handler, uart);
//    SET_PERI_REG_MASK(UART_INT_ENA(0), UART_RXFIFO_FULL_INT_ENA);
//    ETS_UART_INTR_ENABLE();
}

void ICACHE_FLASH_ATTR uart1_interrupt_disable(uart_t* uart)
{
    CLEAR_PERI_REG_MASK(UART_INT_ENA(1), UART_RXFIFO_FULL_INT_ENA);
    ETS_UART_INTR_DISABLE();
}

void ICACHE_FLASH_ATTR uart1_arm_tx_interrupt()
{
    SET_PERI_REG_MASK(UART_INT_ENA(1), UART_TXFIFO_EMPTY_INT_ENA);
}

void ICACHE_FLASH_ATTR uart1_disarm_tx_interrupt()
{
    CLEAR_PERI_REG_MASK(UART_INT_ENA(1), UART_TXFIFO_EMPTY_INT_ENA);
}

void ICACHE_FLASH_ATTR uart1_set_baudrate(uart_t* uart, int baud_rate)
{
    uart->baud_rate = baud_rate;
    uart_div_modify(1, UART_CLK_FREQ / (uart->baud_rate));
}

int ICACHE_FLASH_ATTR uart1_get_baudrate(uart_t* uart)
{
    return uart->baud_rate;
}

uart_t* ICACHE_FLASH_ATTR uart1_init(int baudrate)
{
    uart_t* uart = (uart_t*) os_malloc(sizeof(uart_t));

    PIN_PULLUP_DIS(PERIPHS_IO_MUX_GPIO2_U);
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK);

    // NO RX PIN only possible GPIO8 but no access to it
    // PIN_PULLUP_EN(PERIPHS_IO_MUX_U0RXD_U);
    // PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD);

    uart1_set_baudrate(uart, baudrate);
    WRITE_PERI_REG(UART_CONF0(1), 0x3 << UART_BIT_NUM_S);   // 8n1

    uart1_flush(uart);
    uart1_interrupt_enable(uart);

    WRITE_PERI_REG(UART_CONF1(1), ((0x20 & UART_TXFIFO_EMPTY_THRHD) << UART_TXFIFO_EMPTY_THRHD_S));
    //((0x01 & UART_RXFIFO_FULL_THRHD) << UART_RXFIFO_FULL_THRHD_S) |

    return uart;
}

void ICACHE_FLASH_ATTR uart1_uninit(uart_t* uart)
{
    uart1_interrupt_disable(uart);
    // TODO: revert pin functions
    os_free(uart);
}

void ICACHE_FLASH_ATTR uart1_swap(uart_t* uart)
{

}

void ICACHE_FLASH_ATTR
uart1_ignore_char(char c)
{    
}

void ICACHE_FLASH_ATTR
uart1_write_char(char c)
{
    if (c == '\n')
        WRITE_PERI_REG(UART_FIFO(1), '\r');

    WRITE_PERI_REG(UART_FIFO(1), c);
}

static bool s_uart_debug_enabled = true;
void ICACHE_FLASH_ATTR uart1_set_debug(bool enabled)
{
    s_uart_debug_enabled = enabled;
    if (enabled)
    {
        system_set_os_print(1);
        ets_install_putc1((void *)&uart1_write_char);
    }
    else
        ets_install_putc1((void *)&uart1_ignore_char);
}

bool ICACHE_FLASH_ATTR uart1_get_debug()
{
    return s_uart_debug_enabled;
}

ICACHE_FLASH_ATTR HardwareSerial1::HardwareSerial1() :
    _uart(0), _tx_buffer(0)
//_rx_buffer(0),
{
}

void ICACHE_FLASH_ATTR HardwareSerial1::begin(unsigned long baud, byte config)
{
 //   _rx_buffer = new cbuf(SERIAL1_RX_BUFFER_SIZE);
    _tx_buffer = new cbuf(SERIAL1_TX_BUFFER_SIZE);
    uart1_set_debug(false);
    _uart = uart1_init(baud);
    _written = false;
    delay(1);
}

void ICACHE_FLASH_ATTR HardwareSerial1::end()
{
    uart1_uninit(_uart);
 //   delete _rx_buffer;
    delete _tx_buffer;
    _uart = 0;
  //  _rx_buffer = 0;
    _tx_buffer = 0;
}

void ICACHE_FLASH_ATTR HardwareSerial1::swap()
{
}

void ICACHE_FLASH_ATTR HardwareSerial1::setDebugOutput(bool en)
{
    uart1_set_debug(en);
}

int ICACHE_FLASH_ATTR HardwareSerial1::available(void)
{
   // return static_cast<int>(_rx_buffer->getSize());
    return 0;
}

int ICACHE_FLASH_ATTR HardwareSerial1::peek(void)
{
    return -1;
   // return _rx_buffer->peek();
}

int ICACHE_FLASH_ATTR HardwareSerial1::read(void)
{
    return -1;
   // return _rx_buffer->read();
}

int ICACHE_FLASH_ATTR HardwareSerial1::availableForWrite(void)
{
    return static_cast<int>(_tx_buffer->room());
}

void ICACHE_FLASH_ATTR HardwareSerial1::flush()
{
    if (!_written)
        return;

    while (_tx_buffer->getSize() || uart1_get_tx_fifo_room() < UART_TX_FIFO_SIZE)
        yield();

    _written = false;
}

size_t ICACHE_FLASH_ATTR HardwareSerial1::write(uint8_t c)
{
    _written = true;
    size_t room = uart1_get_tx_fifo_room();
    if (room > 0 && _tx_buffer->empty())
    {
        uart1_transmit_char(_uart, c);
        if (room < 10)
        {
            uart1_arm_tx_interrupt();
        }
        return 1;
    }

    while (_tx_buffer->room() == 0)
    {
        yield();
    }

    _tx_buffer->write(c);
    return 1;
}

ICACHE_FLASH_ATTR HardwareSerial1::operator bool() const
{
    return _uart != 0;
}

void ICACHE_FLASH_ATTR HardwareSerial1::_rx_complete_irq(char c)
{
    //_rx_buffer->write(c);
}

void ICACHE_FLASH_ATTR HardwareSerial1::_tx_empty_irq(void)
{
    size_t queued = _tx_buffer->getSize();
    if (!queued)
    {
        uart1_disarm_tx_interrupt();
        return;
    }

    size_t room = uart1_get_tx_fifo_room();
    int n = static_cast<int>((queued < room) ? queued : room);
    while (n--)
    {
        uart1_transmit_char(_uart, _tx_buffer->read());
    }
}


HardwareSerial1.h

/*
  HardwareSerial.h - Hardware serial library for Wiring
  Copyright (c) 2006 Nicholas Zambetti.  All right reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

  Modified 28 September 2010 by Mark Sproul
  Modified 14 August 2012 by Alarus
  Modified 3 December 2013 by Matthijs Kooijman
  Modified 18 December 2014 by Ivan Grokhotkov (esp8266 platform support)
  Modified 30 March 2015 by Markus Sattler (esp8266 platform support for UART1)
*/

#ifndef HardwareSerial1_h
#define HardwareSerial1_h

#include <inttypes.h>

#include "Stream.h"

#define SERIAL1_TX_BUFFER_SIZE 256
//#define SERIAL1_RX_BUFFER_SIZE 256

// // Define config for Serial.begin(baud, config);
// #define SERIAL_5N1 0x00
// #define SERIAL_6N1 0x02
// #define SERIAL_7N1 0x04
// #define SERIAL_8N1 0x06
// #define SERIAL_5N2 0x08
// #define SERIAL_6N2 0x0A
// #define SERIAL_7N2 0x0C
// #define SERIAL_8N2 0x0E
// #define SERIAL_5E1 0x20
// #define SERIAL_6E1 0x22
// #define SERIAL_7E1 0x24
// #define SERIAL_8E1 0x26
// #define SERIAL_5E2 0x28
// #define SERIAL_6E2 0x2A
// #define SERIAL_7E2 0x2C
// #define SERIAL_8E2 0x2E
// #define SERIAL_5O1 0x30
// #define SERIAL_6O1 0x32
// #define SERIAL_7O1 0x34
// #define SERIAL_8O1 0x36
// #define SERIAL_5O2 0x38
// #define SERIAL_6O2 0x3A
// #define SERIAL_7O2 0x3C
// #define SERIAL_8O2 0x3E

class cbuf;
typedef struct uart_ uart_t;

class HardwareSerial1 : public Stream
{
public:
    HardwareSerial1();

    void begin(unsigned long baud) { begin(baud, 0); }
    void begin(unsigned long, uint8_t);
    void end();
    void swap();  //use GPIO13 and GPIO15 as RX and TX
    int available(void) override;
    int peek(void) override;
    int read(void) override;
    int availableForWrite(void);
    void flush(void) override;
    size_t write(uint8_t) override;
    inline size_t write(unsigned long n) { return write((uint8_t)n); }
    inline size_t write(long n) { return write((uint8_t)n); }
    inline size_t write(unsigned int n) { return write((uint8_t)n); }
    inline size_t write(int n) { return write((uint8_t)n); }
    using Print::write; // pull in write(str) and write(buf, size) from Print
    operator bool() const;

    void setDebugOutput(bool);

    void _tx_empty_irq(void);

protected:
    friend void uart1_interrupt_handler(uart_t* uart);
    void _rx_complete_irq(char c);


protected:
    uart_t* _uart;
    cbuf*   _tx_buffer;
   // cbuf*   _rx_buffer;
    bool    _written;
};

extern HardwareSerial1 Serial1;

#endif

build improvement for Windows users

Hello, I tried to build the arduino-1.6.1-windows.zip from source on Windows 7, 64. I had two issues, which I have fixed by myselve however could be good to maybe improve the ant build process. The first problem was with missing unzip program and the second was with missing tar program. I belive, that most people are building under linux, so this is by default there, but not under windows. I've just copied the unzip.exe and tar.exe to the build directory and everything was fine then.

WIFI UDP no longer receives data after data is sent

Alse posted on ESP8266.com forumn.

I'm not entirely sure that this is a bug but I can't see any other explanation for the behavior. I am using the following code on which is connected to a python script which essentially acts as a terminal-esque way of sending and receiving data to the ESP. The code below works and I can have the light set on or off. The problem is that, after a message has been sent using sendMessage, the ESP will no longer receive packets. I can see from the serial output that the loop is still running and if I remove the call to sendMessage, it will continue turning the light on and off merrily. I wonder if I'm just missing something?

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>

WiFiClient client;
WiFiUDP port;

char packetBuffer[255];
unsigned int localPort = 9999;
IPAddress serverIP(192, 168, 1, 117);


void setup() {
  Serial.begin(9600);
  WiFi.begin("******", "********");
  port.begin(9999);
  pinMode(2, OUTPUT);
  digitalWrite(2,LOW);
}

void loop() {
  int packetSize = port.parsePacket();
  Serial.println(packetSize);
  if (packetSize) {
    int len = port.read(packetBuffer, 255);
    if (len > 0) packetBuffer[len] = 0;
    Serial.println(packetBuffer);
    handleMessage(String(packetBuffer));
  }
  delay(500);
}

void handleMessage(String data) {
  if(data=="on"){
    digitalWrite(2,HIGH);
    Serial.println("ON");
    sendMessage("light on");
  }
  if(data=="off"){
    digitalWrite(2,LOW);
    Serial.write("OFF");
    sendMessage("light off");
  }
}

void sendMessage(char data[]) {
  port.beginPacket(serverIP,localPort);
  port.write(data);
  port.endPacket();
}

From what I can see, it looks like the call to beginPacket in WiFiUDP.cpp resets everything when it calls: _ctx->unref();
In order to try and get around this I have tried calling stop and then begin again after a transmission to restart the listening but to no avail.

int WiFiUDP::beginPacket(IPAddress ip, uint16_t port)
{
    ip_addr_t addr;
    addr.addr = ip;

    if (_ctx)
        _ctx->unref();
    _ctx = new UdpContext;
    return (_ctx->connect(addr, port)) ? 1 : 0;
}

Install via Board manager

With the 1.6.2 IDE release, there is now a way to download new boards directly. Will this implementation be able to support the manager? It would be nice to be able to use a single IDE rather than a fork.

Issues converting string to float

Having trouble to convert string to float:
Using:
value = strValue.toFloat();
always result in 0.00

Tried workaround using
value = atof(buf);
but this results into compiler errors:
c:/tools/arduino-1.6.1/hardware/tools/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\mari\AppData\Local\Temp\build3253580446183462334.tmp/ESPClient1.cpp.elf section .text' will not fit in regioniram1_0_seg'
c:/tools/arduino-1.6.1/hardware/tools/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-mallocr.o):(.literal+0x2c): undefined reference to _sbrk_r' c:/tools/arduino-1.6.1/hardware/tools/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-mallocr.o): In functionmalloc_extend_top':
d:\ivan\projects\arduinoesp\toolchain\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/mallocr.c:2165: undefined reference to _sbrk_r' d:\ivan\projects\arduinoesp\toolchain\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/mallocr.c:2202: undefined reference to_sbrk_r'
c:/tools/arduino-1.6.1/hardware/tools/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-freer.o): In function _malloc_trim_r': d:\ivan\projects\arduinoesp\toolchain\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/mallocr.c:3325: undefined reference to_sbrk_r'
d:\ivan\projects\arduinoesp\toolchain\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/mallocr.c:3332: undefined reference to _sbrk_r' c:/tools/arduino-1.6.1/hardware/tools/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-freer.o):d:\ivan\projects\arduinoesp\toolchain\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/mallocr.c:3340: more undefined references to_sbrk_r' follow
collect2.exe: error: ld returned 1 exit status

Error on upload - Windows

Any suggestions on what is going wrong here? Using the Arduino ESP8266 IDE to try and upload the HelloServer example.

ESP-01 is on COM4 on Windows via a FTDI TTL converter.
Board is set to Generic ESP8266. Programmer to ESPtool.

Any assistance gratefully received.

Cheers

Pete

esptool v0.4.2 - (c) 2014 Ch. Klippel <[email protected]>
    setting board to none
    setting baudrate from 115200 to 115200
    setting port from COM1 to COM4
    setting address from 0x00000000 to 0x00000000
    espcomm_upload_file
    stat C:\Users\peter\AppData\Local\Temp\build4325786157015904206.tmp/HelloServer.cpp_00000.bin success
    setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_cmd: sending command header
    espcomm_cmd: sending command payload
    serialport_receive_C0: 00 instead of C0
trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_cmd: sending command header
    espcomm_cmd: sending command payload
    serialport_receive_C0: 00 instead of C0
trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_cmd: sending command header
    espcomm_cmd: sending command payload
    serialport_receive_C0: 00 instead of C0
resetting board
trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_cmd: sending command header
    espcomm_cmd: sending command payload
    serialport_receive_C0: 00 instead of C0
trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_cmd: sending command header
    espcomm_cmd: sending command payload
    serialport_receive_C0: 00 instead of C0
trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_cmd: sending command header
    espcomm_cmd: sending command payload
    serialport_receive_C0: 00 instead of C0
resetting board
trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_cmd: sending command header
    espcomm_cmd: sending command payload
    serialport_receive_C0: 00 instead of C0
trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_cmd: sending command header
    espcomm_cmd: sending command payload
    serialport_receive_C0: 00 instead of C0
trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_cmd: sending command header
    espcomm_cmd: sending command payload
    serialport_receive_C0: 00 instead of C0
warning: espcomm_sync failed
error: espcomm_open failed

Got an error when flashing

Sketch uses 196,284 bytes (37%) of program storage space. Maximum is 524,288 bytes.
java.lang.NullPointerException
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingProgrammer(SerialUploader.java:246)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:75)
at processing.app.debug.Compiler.upload(Compiler.java:157)
at processing.app.Sketch.upload(Sketch.java:1259)
at processing.app.Sketch.exportApplet(Sketch.java:1201)
at processing.app.Sketch.exportApplet(Sketch.java:1173)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2432)
at java.lang.Thread.run(Thread.java:745)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Calibrate Wire.setClock so it sets correct frequency

This is more a observation then issue report since you have already written in description that Wire.setClock gives weird frequency. I played with it a while and found that at 400 it gives frequency around 1khz. At 300000 and more it doesnt work at all since the scl is all distorted and non consistent (more like some noise). Maximum frequency I got was ~307kHz with set values around 180000-200000.

"Error Compiling"

I downloaded the windows.zip for release "1.6.1-esp8266-1"

When I compile a blank sketch:

void setup(){}
void loop(){}

I get "Error Compiling", any ideas what I could be doing wrong?

I'm running Windows 7 64bit.

Interrupts setuped with `attachInterrupt` are very slow.

Something seems to be wrong with the way how interrupts are handled.

I'm trying to record pulses of length 250-2000 micros. Example sketch:

volatile int lastTime = 0;

void setup()
{                
  Serial.begin(115200);
  attachInterrupt(2, pinChanged, CHANGE);
}

void loop()                     
{
}

void pinChanged()
{
  int time = micros();
  int duration = time - lastTime;
  Serial.print(duration);
  Serial.print("\r\n");
  lastTime = time;
}

But this outputs something like:

76131
3683
76143
3752
76146
3667
76128
3768
76141
3741
76148
3661
76114
3785
76130
3683
...

I exprected numbers around 250-2000. It's stange that its almost all time a longer dealy and then a shorter. I double checked the wiring and the interrupts only occure with connected sensor.

I did the same using nodemcu (using gpio.trig) and got ver accurate timings.

Any ideas what is going wrong here?

add support for Arduino Eclipse Plugin

add support for Arduino Eclipse Plugin (http://www.baeyens.it/eclipse/)

change the platform.txt, the Compiling is working.
the serial upload in current broken.

@@ -17,6 +17,9 @@ compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH "-I{compiler.sdk.path}/inc
 compiler.c.cmd=xtensa-lx106-elf-gcc
 compiler.c.flags=-c -Os -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -MMD -std=c99

+compiler.S.cmd=xtensa-lx106-elf-gcc
+compiler.S.flags=-c -g -x assembler-with-cpp -MMD
+
 compiler.c.elf.ldscript=eagle.app.v6.ld
 compiler.c.elf.flags=-nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{compiler.c.elf.ldscript}"
 compiler.c.elf.cmd=xtensa-lx106-elf-gcc
@@ -57,7 +60,7 @@ recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.fla
 recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

 ## Compile S files
-recipe.S.o.pattern="{compiler.path}{compiler.as.cmd}"  -o "{object_file}" "{source_file}"
+recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

 ## Create archives
 recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"

hope this help.

PubSub missing

PubSub appears to be missing from the libraries and the original pubsub won't compile.

Unsupported baud rate 115200

The examples use 115200 baud ratge - yet the compiler complains that it's an invalid baud rate - it still works of course. Can this be removed?

How to detect the use of the ESP8266 ?

I am the developer of the aREST library (http://arest.io) that implements a REST interface for Arduino & Raspberry Pi boards.

I am currently working on adapting the aREST Arduino library to your project, it nearly works but in the code I need to detect when an ESP8266 is used, and when a classical Arduino is used. For example to detect an Arduino Mega I use:

if defined(AVR_ATmega1280)

Is there something similar I could use to detect that the ESP8266 is selected? Thanks!

build gcc with lto support

The included gcc wasn't built with the linker plugin, so enabling link-time optimization (-flto) fails.
dlopen:'.../arduino-1.6.1/hardware/tools/esp8266/xtensa-lx106-elf/bin/../libexec/gcc/xtensa-lx106-elf/4.8.2/liblto_plugin-0.dll': The specified module could not be found.
Lto not only reduces code size, it can significantly improve performance by doing constant folding for function calls like digitalWrite.
http://nerdralph.blogspot.ca/2014/04/gcc-link-time-optimization-can-fix-bad.html

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Infrared Library

Hi,

does somebody know a infrared library which works with this esp8266 Arduino IDE ?
Id not found one, because they all dependt on avr interupts.

Arduino: 1.6.1 (Windows 8.1), Platine: "Generic ESP8266 board"

C:\Users####\Documents\Arduino\libraries\Arduino-IRremote\IRremote.cpp:25:27: fatal error: avr/interrupt.h: No such file or directory

#include < avr/interrupt.h >

compilation terminated.

Sorry for my English.
Thanks in advance.

add bitbang spi function - enhancement

I was measured 4.81mbps for the following code:
void shiftOutFast(byte data)
{
byte i = 8;
do{
GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, 1 << CLOCK);
if(data & 0x80)
GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, 1 << DATA);
else
GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, 1 << DATA);
GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, 1 << CLOCK);
data <<= 1;
}while(--i);
return;
}

http://nerdralph.blogspot.ca/2015/04/a-4mbps-shiftout-for-esp8266arduino.html

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

i2c returns error=0, although no device connected

I have an 1306 OLED diplsay and wanted to at least verify the i2c address so i thought running http://playground.arduino.cc/Main/I2cScanner might be a nice idea.

I wired up 2 external pullups and changed to code to include

Wire.pins(12, 14);
Wire.begin();

But I get the following for all i2c addresses which cant be right:

Scanning...<\r><\n>
I2C device found at address 0x01 !<\r><\n>
I2C device found at address 0x02 !<\r><\n>
I2C device found at address 0x03 !<\r><\n>
I2C device found at address 0x04 !<\r><\n>
I2C device found at address 0x05 !<\r><\n>
I2C device found at address 0x06 !<\r><\n>

Remember: Nothing connected

A logic sniffer seems to return nothing unusual too:

i2c

EDIT: Apparently the esp8266 i2c function does use a different return code. Its the number of successfully received bytes I guess

size_t i2c_master_write_to(int address, const uint8_t* data, size_t size, bool sendStop)
{
    i2c_start();
    i2c_write(address << 1);
    int ack = i2c_get_ack();
    const uint8_t* end = data + size;
    for (;data != end; ++data )
    {
        i2c_write(*data);
        ack = i2c_get_ack();
    }
    if (sendStop)
        i2c_stop();
    return size;
}

EDIT2: After connecting the 1306 oled to a separate arduino and check the i2c address to be 0x3C i meddled a little bit with the Adafruit_SSD1306master, removing conflicting code and adding the esp8266 i2c init I was able to at least draw some lines. Have still to look why the lib hangups, I guess its a wdt timeout issue

SSL support

Hi!
I would like to know if you plan to include SSL support in the libraries.
I've tryed to send some https requests with no sucess.

It would be cool if it the ESP could act as a secure server too.

I've checked the some examples from the sdk and they have a code to create a secure server with digital certificate.

Thanks!

Issue with Olimex ESP8266 module

Hello, great work on this project! I tested it and it works fine with the simple 8-pin ESP8266 module (the $5 one).

However, I've been trying with this module:

https://www.olimex.com/Products/IoT/MOD-WIFI-ESP8266-DEV/

And it doesn't work. I can upload the sketch but after that it fails and only return strange characters in the Serial monitor. I guess this is either because the flash memory is different from the other module, and because the clock is also different. Do you think that might be the cause? If yes, do you have plans to support different ESP8266 flash sizes/clocks in the future? Thanks

Issue compiling MODBUS library

Hello!
I just wanted to compile the arduino-modbus-slave library (https://code.google.com/p/arduino-modbus-slave/downloads/detail?name=MODBUS.zip&can=2&q=) which seems to be perfectly compatible with the ESP8266 Arduino SDK because it only uses the Serial library which is fully adopted.
When I try to compile my sketch which depends on the MODBUS library I get the following error:
bildschirmfoto 2015-03-29 um 15 21 24

Does anybody know where the issue is?
It seems to be an issue with the xtensa toolchain but I cannot find out what it is.

Kind Regards
Marvin

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.