Downloading and installing the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By Drpepper
#60435 This is my First time Tring to use the Arduino IDE
I used the Arduino 1.6.8 Full Install
I used http://arduino.esp8266.com/stable/packa ... index.json
The program is simple:

void setup() {
}
void loop() {
Serial.print("Running...");
delay(5000); // wait for a second
}
The Scatch Loads:
Scatch uses 222,201 bytes (51%) of program storage space. Maximum is 434,160 bytes.
Global variables use 31,576 bytes (38%) of dynamic memory, leaving 50,344 bytes for local variables. Maximum is 81,920 bytes.
Uploading 226352 bytes from C:\Users\Phil\AppData\Local\Temp\build57ccb91eeb651087b4eac8c48d58bb05.tmp/sketch_jan04a.ino.bin to flash at 0x00000000
................................................................................ [ 36% ]
................................................................................ [ 72% ]
..............................................................
But The Serial Monitor is Empty
IF I reset, I get a little trash, but nothing else..
What Am I doing wrong?
User avatar
By mrburnette
#60465 Try my blink-n-count (your LED may be on a different pin... so, adjust!)

Code: Select all/*
  BlinkNcount for ESP8266 NodeMCU by m. ray burnette
  Compiled on Linux Mint 17.8 64-bit
  Arduino 1.6.8 tested on 20160409  http://esp8266.github.io/Arduino/versions/2.1.0/
    Sketch uses 231,213 bytes (22%) of program storage space. Maximum is 1,044,464 bytes.
    Global variables use 31,596 bytes (38%) of dynamic memory, leaving 50,340 bytes for local variables.
  Turns on an LED on for one second, then off for one second, repeatedly.
  Counts and displays the count on the attached serial monitor
  This example code is in the public domain.
 */

#define BOARD_LED_PIN   2
int n = 0;


void setup() {               
  // initialize the digital pin as an output.
  pinMode(BOARD_LED_PIN, OUTPUT);
  // Initialize virtual COM over USB on Maple Mini
  Serial.begin(115200);
  digitalWrite(BOARD_LED_PIN,!digitalRead(BOARD_LED_PIN));// Turn the LED from off to on, or on to off
  Serial.println("Blink LED & count Demo");
}

void loop() {
  long uSeconds = micros();
  digitalWrite(BOARD_LED_PIN, HIGH);   // set the LED on
  delay(500);                          // wait for half-second
  digitalWrite(BOARD_LED_PIN, LOW);    // set the LED off
  Serial.print("Loop #: ");
  n++;
  Serial.print(n);
  Serial.print("            uS=");
  Serial.println(micros()-uSeconds);
   
  delay(500);                          // wait another half-second
}
User avatar
By mrburnette
#60471
Drpepper wrote:Thanks that worked :P
Woot. I like the C over LUA. I missed my Casting.. lol



I have a bit more stuff here: https://www.hackster.io/rayburne/projects

Glad you are up & running ... The ESP8266 is fun ... but, be careful of how you integrate your C/C++ code ... the microcontroller shares the Arduino code with the base RF libraries ... the two sets of code run under a very simple task manager: NON-OS... one task at a time! Your Arduino code must return to loop() every 30mS to 50mS (depending on the article you read) or you must pat the watchdog by using delay(nn), delay(0), or yield().
See my article: https://www.hackster.io/rayburne/esp8266-turn-off-wifi-reduce-current-big-time-1df8ae


Ray

For grins, the same blink n count as above but at 160MHz:
Code: Select all/*
  BlinkNcount for ESP8266 NodeMCU by m. ray burnette
  Compiled on Linux Mint 17.8 64-bit
  Arduino 1.6.8 tested on 20160409  http://esp8266.github.io/Arduino/versions/2.1.0/
    Sketch uses 231,213 bytes (22%) of program storage space. Maximum is 1,044,464 bytes.
    Global variables use 31,596 bytes (38%) of dynamic memory, leaving 50,324 bytes for local variables. Maximum is 81,920 bytes.
  Turns on an LED on for one second, then off for one second, repeatedly.
  Counts and displays the count on the attached serial monitor
  This example code is in the public domain.
 */

#define BOARD_LED_PIN   2
int n = 0;

extern "C" {
#include "user_interface.h"
}

void setup() {
  // system_update_cpu_freq(80);
  system_update_cpu_freq(160);
  // initialize the digital pin as an output.
  pinMode(BOARD_LED_PIN, OUTPUT);
  // Initialize virtual COM
  Serial.begin(115200);
  digitalWrite(BOARD_LED_PIN,!digitalRead(BOARD_LED_PIN));// Blink

  delay(100);         // fast blink
  Serial.println("Blink LED & count Demo");
}

void loop() {
  long uSeconds = micros();
  digitalWrite(BOARD_LED_PIN, HIGH);   // set the LED on
  //delay(500);              // wait for half-second
  digitalWrite(BOARD_LED_PIN, LOW);    // set the LED off
  Serial.print("Loop #: ");
  n++;
  Serial.print(n);
  Serial.print("            uS=");
  Serial.println(micros()-uSeconds);
   
  // delay(500);              // wait another half-second
}