
Arduino . , . >10 .
?
, Arduino , IDE :
- - , Gemfile/requirements.txt/package.json,
- Git VCS
Arduino
. , . Atmel Studio Visual Studio CE . .
Ino
Ino — , Arduino.
, >200 . 2014, IDE ( 1.5).
Arturo, , - .
Arduino-Makefile
Arduino-Makefile — make. Arduino Due, Zero 32- . IDE , , . , Arduino-Makefile SparkFun Pro Micro.
PlatformIO
PlatformIO — , . , (Atmel AVR, Atmel SAM, ST STM32, TI MSP430 ). ( PlatformIO ): Arduino, Energia, mbed, Atmel AVR, espressif, MSP430.
PlatformIO , IDE:
Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, Vim Visual StudioPlatformIO :
- , ..
- , .. ,
- ssh, PlatformIO Raspberry Pi

Arduino
,
,
Quick StartPlatformIO Arduino IDE, platformio.ini . .
PlatformIO Arduino. , PlatformIO. platformio.ini :
[env:nanoatmega328]
platform = atmelavr
framework = arduino
board = nanoatmega328
[env:sparkfun_promicro16]
platform = atmelavr
framework = arduino
board = sparkfun_promicro16
[env:due]
platform = atmelsam
framework = arduino
board = due
[env:teensy31]
platform = teensy
framework = arduino
board = teensy31
[env:nodemcu]
platform = espressif
framework = arduino
board = nodemcu
[env:uno]
platform = atmelavr
framework = arduino
board = uno
:
platformio run
uno :
platformio run -e uno
uno:
platformio run --target upload -e uno
:
platformio serialports monitor
.zshrc :
alias compile="platformio run"
alias upload="platformio run --target upload"
alias serial="platformio serialports monitor"
:
compile
compile -e uno
upload -e uno
serial
Travis CI CI ,
.
- Arduino IDE
, .
PlatformIO
PlatformIO , Arduino IDE . :
- PlatformIO Arduino IDE, PlatformIO Arduino IDE
- Arduino IDE
- platformio lib
Serial.print(" ");
?
Serial.print()
, "pin_2 = < 2>, pin_3 = < 3>" :
Serial.print("pin_2 = ");
Serial.print(digitalRead(2));
Serial.print(", pin_3 = ");
Serial.println(digitalRead(3));
, . Serial.print(), .
arduinoLogging
printf- , LOGLEVEL . Error, Info, Debug Verbose.
:
#include "Logging.h"
#define LOGLEVEL LOG_LEVEL_INFOS
void setup() {
Serial.begin(9600);
Log.Init(LOGLEVEL, &Serial);
Log.Info("pin_2 = %d, pin_3 = %d"CR, digitalRead(2), digitalRead(3));
Log.Debug(" , LOGLEVEL = LOG_LEVEL_INFOS");
}
wildcard | comment | Example |
---|
%s | replace with an string (char*) | Log.Info("String %s", myString); |
%c | replace with an character | Log.Info("use %c as input", myChar) |
%d | replace with an integer value | Log.Info("current value %d",myValue); |
%l | replace with an long value | Log.Info("current long %l", myLong); |
%x | replace and convert integer value into hex | Log.Info ("as hex %x), myValue); |
%X | like %x but combine with 0x123AB | Log.Info ("as hex %X), myValue); |
%b | replace and convert integer value into binary | Log.Info ("as bin %b), myValue); |
%B | like %x but combine with 0b10100011 | Log.Info ("as bin %B), myValue); |
%t | replace and convert boolean value into "t" or "f" | Log.Info ("is it true? %t), myBool); |
%T | like %t but convert into "true" or "false" | Log.Info ("is it true? %T), myBool); |
advancedSerial
Error, Info, Debug Verbose arduinoLogging . Error , LOGLEVEL ( NOOUTPUT).
printf ,
advancedSerial.
advancedSerial : print() println() .
int a = 1;
int b = 2;
aSerial.print("a = ").print(a).print("b = ").println(b);
aSerial.p("a = ").p(a).p("b = ").pln(b);
Basic.inoSerial.print() Serial.println(), , , Serial aSerial.
v, vv, vvv, vvvv, , -v, -vv .
, vv -> vvv Info -> Debug.
#include "advancedSerial.h"
void setup() {
Serial.begin(9600);
aSerial.setPrinter(Serial);
aSerial.setFilter(Level::vv);
}
void loop() {
aSerial.l(Level::vv).pln(" ");
aSerial.l(Level::vvv).pln(" ");
delay(3000);
}
Advanced.inoF(), (SRAM), F():
aSerial.print(F(" 16 "));
advancedSerial Serial, . Arduino Uno, 2KB .
, - : void setup() {
Serial.begin(9600);
}
void loop() {
Serial.print("test");
Serial.println("test");
}
storage space: 5%
dynamic memory: 9%
advancedSerial: #include <advancedSerial.h>
void setup() {
Serial.begin(9600);
aSerial.setPrinter(Serial);
aSerial.setFilter(Level::vv);
}
void loop() {
aSerial.print("test").println("test");
}
storage space: 5%
dynamic memory: 10%
examples/Advanced.inostorage space: 9%
dynamic memory: 26%
examples/Advanced.ino F()storage space: 9%
dynamic memory: 10%
. advancedSerial , ,
Debug.
?
Arduino IDE ( #include ) . - , . , . Arduino IDE PlatformIO.
Arduino IDE
Arduino IDE, . : (?) libraries ( Arduino IDE).
, , Arduino IDE libraries , libraries . Arduino IDE.
PlatformIO
PlatformIO lib, . . PlatformIO platformio lib, , lib platformio.ini :
[platformio]
lib_dir = ./lib
platformio lib
.