Dependancies
Buy the components
blinky-esp8266.ino
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Serial.begin(115200);
Serial.println("Start blinky");
}
void loop() {
ledON();
delay(1000);
ledOFF();
delay(1000);
}
void ledON() {
Serial.println("LED ON");
digitalWrite(LED_BUILTIN, LOW);
}
void ledOFF() {
Serial.println("LED OFF");
digitalWrite(LED_BUILTIN, HIGH);
}
BOARD?=esp8266:esp8266:d1_mini
PORT?=/dev/cu.usbserial-14*
BUILD=build
.PHONY: default lint all flash clean
default: lint all flash clean
lint:
cpplint --extensions=ino --filter=-legal/copyright *.ino
all:
arduino-cli compile --fqbn $(BOARD) --output-dir $(BUILD) ./
flash:
arduino-cli upload --fqbn $(BOARD) --port $(PORT) --input-dir $(BUILD)
clean:
rm -r build
LED_BUILTIN
can be referred as the pin for the on-board LED. It has a reverse logic.
HIGH
is LED offLOW
is LED onError on uploading:
pyserial or esptool directories not found next to this upload.py tool.
An error occurred while uploading the sketch
The solution is to edit the file ~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial/serial/tools/list_ports_osx.py
L29-L30
. Fix the relative paths for IOKit
and CoreFoundation
to absolute paths.