DFRobot FireBeetle ESP8266 Manual - Página 6
Navegue en línea o descargue pdf Manual para Microcontroladores DFRobot FireBeetle ESP8266. DFRobot FireBeetle ESP8266 8 páginas. Iot microcontroller
Sample Code ‐ Blink
The default LED for FireBeetle Board-ESP8266 is D5 (IO2), input following code:
// GPIO 2 (D5) has a LED_BLINK attached to it. Give it a name:
int LED_BLINK = 2;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BLINK, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BLINK, HIGH);
vel)
delay(1000);
digitalWrite(LED_BLINK, LOW);
LOW
delay(1000);
}
Note: ESP8266 has different pinmap in different development environment, For example: the LED
connects IO2, which maps D5 in Arduino IDE It is totally different mean with 2 and D2 !
Sample Code ‐ Scan WiFi
After you have installed the FireBeetle ESP8266 development environment, it will comes with a lot of
sample code in Arduino IDE, you can find them in File > Examples. The follow sample code scans
the around WiFi:
/*
*
This sketch demonstrates how to scan WiFi networks.
*
The API is almost the same as with the WiFi Shield library,
*
the most obvious difference being the different file you need to include:
*/
#include "ESP8266WiFi.h"
// turn the LED on (HIGH is the voltage le
// wait for a second
// turn the LED off by making the voltage
// wait for a second