First commit
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
default_envs = mkrvidor4000
|
||||
|
||||
[env:teensy41]
|
||||
platform = teensy
|
||||
board = teensy41
|
||||
framework = arduino
|
||||
lib_extra_dirs = ../../..
|
||||
;lib_deps = epsilonrt/Modbus-Serial@^2.0.3
|
||||
|
||||
[env:mkrvidor4000]
|
||||
platform = atmelsam
|
||||
board = mkrvidor4000
|
||||
framework = arduino
|
||||
lib_extra_dirs = ../../..
|
||||
;lib_deps = epsilonrt/Modbus-Serial@^2.0.3
|
||||
|
||||
[env:mkrvidor4000-debug]
|
||||
platform = atmelsam
|
||||
framework = arduino
|
||||
board = mkrvidor4000
|
||||
debug_tool = atmel-ice
|
||||
|
||||
|
||||
; Debugger (gdb) support
|
||||
; https://docs.arduino.cc/tutorials/mkr-wifi-1010/mkr-jlink-setup
|
||||
; https://gojimmypi.blogspot.com/2018/12/swd-debugging-arduino-mkr-wifi-1010.html
|
||||
|
||||
build_type = debug
|
||||
lib_extra_dirs = ../../..
|
||||
;lib_deps = epsilonrt/Modbus-Serial@^2.0.3
|
||||
|
||||
; activate Dual USB just as README says
|
||||
build_flags =
|
||||
-DDEBUG # Comment out to disable debugging.
|
||||
;debug_build_flags = -O0 -g2 -ggdb2
|
||||
debug_build_flags = -O0 -ggdb3 -g3
|
||||
|
||||
[env:esp32]
|
||||
framework = arduino
|
||||
platform = espressif32
|
||||
; change for your board : https://registry.platformio.org/platforms/platformio/espressif32/boards
|
||||
board = esp32doit-devkit-v1
|
||||
;board_build.f_cpu = 240000000L
|
||||
lib_extra_dirs = ../../..
|
||||
;lib_deps = epsilonrt/Modbus-Serial@^2.0.3
|
||||
;upload_port = COM9
|
||||
|
||||
[env:esp32-debug]
|
||||
; https://dzone.com/articles/eclipse-jtag-debugging-the-esp32-with-a-segger-j-l
|
||||
; https://docs.platformio.org/en/latest/tutorials/espressif32/arduino_debugging_unit_testing.html
|
||||
; https://community.platformio.org/t/esp32-and-segger-jlink-tip-for-interface-setup-configuration/25964
|
||||
framework = arduino
|
||||
platform = espressif32
|
||||
; change for your board : https://registry.platformio.org/platforms/platformio/espressif32/boards
|
||||
board = esp32doit-devkit-v1
|
||||
;board_build.f_cpu = 240000000L
|
||||
lib_extra_dirs = ../../..
|
||||
;lib_deps = epsilonrt/Modbus-Serial@^2.0.3
|
||||
upload_port = COM1
|
||||
debug_tool = jlink
|
@@ -0,0 +1,28 @@
|
||||
#include <Arduino.h>
|
||||
#include <ModbusSerial.h>
|
||||
|
||||
ModbusSerial mb (Serial, 10);
|
||||
|
||||
const uint8_t NbOfCoil = 19;
|
||||
const uint16_t FirstCoil = 20;
|
||||
const uint32_t CoilValues = 0x056BCD;
|
||||
|
||||
void setup() {
|
||||
#ifdef ESP32
|
||||
Serial.begin (38400, SERIAL_8E1);
|
||||
#else
|
||||
Serial.begin (38400);
|
||||
#endif
|
||||
mb.config (38400);
|
||||
|
||||
for (uint8_t i = 0; i < NbOfCoil; i++) {
|
||||
|
||||
mb.addCoil (FirstCoil -1 + i, (CoilValues & (1 << i)) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
mb.task();
|
||||
}
|
||||
|
Reference in New Issue
Block a user