The main idea of this project is arduino clock with flexible second time. This would allow to speed up or slow down the time.
You are going to need:
- ESP8266 (wemos or nodemcu version)
- 1602 LCD screen with i2c converter
- rotary encoder, i.e. KY-040
- real time clock, i.e. DS3231
For VS Code install Clang-Format extension.
To format currently edited file use [ctlr] + [shift] + [i]
keyboard shortcut.
To format all files at once (with clang-format installed on your system):
clang-format -style=llvm -i crazyclock.ino
find src -iname "*.h" -o -iname "*.cpp" -o -iname "*.ino" | xargs clang-format -style=llvm -i
We keep components in src folder.
-
Create configuration file:
arduino-cli config init
-
Add esp8266 URL for board manager:
arduino-cli config add board_manager.additional_urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
-
Configure the autocompletion for command-line (optional step)
-
Install Wemos D1 Mini board:
arduino-cli core update-index arduino-cli core install esp8266:esp8266 arduino-cli core list arduino-cli board listall esp8266:d1
- Watch for logs with:
sudo dmesg -w | grep USB
- Connect your device via USB
- Write down the ID for the USB device (i.e. ttyUSB0)
- Show permissions for the device:
ls -lah /dev/ttyUSB0
- Write down the group of the device (i.e. uucp)
- Add your user to the above group:
sudo usermod -a -G uucp $USER
- logout and login again to apply changes
In root directory:
-
Install required libraries (i.e. hd44780):
arduino-cli lib install "hd44780" "NTPClient" "RotaryEncoder" "Time" "Timezone" "DS3231"
-
Compile:
arduino-cli --verbose compile --fqbn esp8266:esp8266:d1
-
Upload:
arduino-cli --verbose upload --fqbn esp8266:esp8266:d1 --port /dev/ttyUSB0
- AUnit library:
arduino-cli lib install AUnit
- EpoxyDuino v1.3.0 in crazyclock
libraries
folder - Set environment variable
ARDUINO_CLI_DIR
forarduino-cli
libraries:export ARDUINO_CLI_DIR=${HOME}/Arduino