I’m new to PlatformIO.
I am trying to import a simple Arduino sketch for Atiny85 but want to include the SendOnlySoftwareSerial library. There are other libraries I also want to use but I thought I’d start with this one as it allows me some debug output on a single pin. Up to now I have dodged the issue by putting all the Arduino library stuff in conditional compile sections, writing (and test compiling) the code in PlatformIO and then doing a final compile in Arduino IDE. This is hard work and I believe I can achieve all this within PlatformIO - I just need help getting started.
Before I opened this topic, I did look at the ‘sounds like a similar’ list of topics and also some postings of how not to manually import Arduino libraries - I have tried a few of these methods but failed here too. Below is the nearest I believe I have come to achieving my goal but I need a bit of help.
The sketch below works if compiled and loaded via Arduino IDE
// ATtiny85SendOnlySoftwareSerial
// Test Arduino sketch to import into PlatformIO
#include <SendOnlySoftwareSerial.h>
#define BAUD 9600 // Check fuse CKDIV8 is un-programmed on ATtiny85
SendOnlySoftwareSerial mySerial (PB1); // Tx pin
/* ATtiny85
PCINT5/-RESET/ACD0/dw PB5 1| u |8 VCC
PCINT3/XTAL1/CLKI/-OC1B/ADC3 PB3 2| |7 PB2 SCK/USCK/SCL/ADC1/T0/INT0/PCINT2
PCINT4/XTAL2/CLKO/OC1B/ADC2 PB4 3| |6 PB1 MISO/DO/AIN1/OC0B/OC1A/PCINT1
GND 4|___|5 PB0 MOSI/DI/SDA/AIN0/OC0A/-OC1A/AREF/PCINT0
PB0 -
PB1 - TTY output
PB2 -
PB3 -
PB4 -
PB5 - (RESET)
*/
void setup() {
// put your setup code here, to run once:
DDRB |= (1<<PB1);
mySerial.begin(BAUD);
mySerial.println(F("\n\r\n\rStarting"));
}
void loop() {
// put your main code here, to run repeatedly:
mySerial.print(F("."));
delay(100);
}
My first attempt at a build on PlatformIO yielded
* Executing task in folder 221022-113635-attiny85: C:\Users\Peter\.platformio\penv\Scripts\platformio.exe run
Processing attiny85 (platform: atmelavr; board: attiny85; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/attiny85.html
PLATFORM: Atmel AVR (3.4.0) > Generic ATtiny85
HARDWARE: ATTINY85 8MHz, 512B RAM, 8KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:
- framework-arduino-avr-attiny @ 1.5.2
- toolchain-atmelavr @ 1.70300.191015 (7.3.0)
Converting ATtiny85SendOnlySoftwareSerial.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 9 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\attiny85\src\ATtiny85SendOnlySoftwareSerial.ino.cpp.o
Archiving .pio\build\attiny85\libFrameworkArduinoVariant.a
Compiling .pio\build\attiny85\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\attiny85\FrameworkArduino\Print.cpp.o
Compiling .pio\build\attiny85\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\attiny85\FrameworkArduino\TinySoftwareSerial.cpp.o
Compiling .pio\build\attiny85\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\attiny85\FrameworkArduino\WInterrupts.c.o
D:/Users/Peter/Documents/PlatformIO/Projects/221022-113635-attiny85/src/ATtiny85SendOnlySoftwareSerial.ino:4:10: fatal error: SendOnlySoftwareSerial.h: No such file or directory
********************************************************************************
* Looking for SendOnlySoftwareSerial.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:SendOnlySoftwareSerial.h"
* Web > https://registry.platformio.org/search?q=header:SendOnlySoftwareSerial.h
*
********************************************************************************
#include <SendOnlySoftwareSerial.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\attiny85\src\ATtiny85SendOnlySoftwareSerial.ino.cpp.o] Error 1
========================================================= [FAILED] Took 3.11 seconds =========================================================
* The terminal process "C:\Users\Peter\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
So I checked your library registry as suggested and it found SendOnlySoftwareSerial.h lurking in
ingarage/Maker PlayGround Device
To install this I added a line to the lib_deps section of my platformio.ini which now looks like
; 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
[env:attiny85]
platform = atmelavr
board = attiny85
framework = arduino
lib_deps = ingarage/Maker PlayGround Device@^1.0.0
I understand that this means any new copies of the library that are back wards compatible with v 1.0.0 will be used.
I did another build with the following output
* The terminal process "C:\Users\Peter\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
* Executing task in folder 221022-113635-attiny85: C:\Users\Peter\.platformio\penv\Scripts\platformio.exe run
Processing attiny85 (platform: atmelavr; board: attiny85; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------Library Manager: Installing ingarage/Maker PlayGround Device @ ^1.0.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
Library Manager: Maker PlayGround Device@1.0.0 has been installed!
Library Manager: Resolving dependencies...
Library Manager: Installing git+https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library.git#1.0.4
Error: Please install Git client from https://git-scm.com/downloads
* The terminal process "C:\Users\Peter\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
I then attempted to install v 2.38.1 of Git and this is the step I think I got wrong because now on doing a build I still get the following output
* Executing task in folder 221022-113635-attiny85: C:\Users\Peter\.platformio\penv\Scripts\platformio.exe run
Processing attiny85 (platform: atmelavr; board: attiny85; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------Library Manager: Installing git+https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library.git#1.0.4
Error: Please install Git client from https://git-scm.com/downloads
* The terminal process "C:\Users\Peter\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
What do I need to do to install the Git client having installed Git by executing the download “Git-2.38.1-64-bit.exe”?
Time passes - I decided to restart PlatformIO and try again - Now I get a slightly different error
* Executing task in folder 221022-113635-attiny85: C:\Users\Peter\.platformio\penv\Scripts\platformio.exe run
Processing attiny85 (platform: atmelavr; board: attiny85; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------Library Manager: Installing git+https://github.com/adafruit/Adafruit_L3GD20_U.git#1.1.0
git version 2.38.1.windows.1
Cloning into 'C:\Users\Peter\.platformio\.cache\tmp\pkg-installing-wb_sw5bh'...
warning: Could not find remote branch 1.1.0 to clone.
fatal: Remote branch 1.1.0 not found in upstream origin
Error: VCS: Could not process command ['git', 'clone', '--recursive', '--depth', '1', '--branch', '1.1.0', 'https://github.com/adafruit/Adafruit_L3GD20_U.git', 'C:\\Users\\Peter\\.platformio\\.cache\\tmp\\pkg-installing-wb_sw5bh']
* The terminal process "C:\Users\Peter\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
So it looks like Git 2.38.1 is loaded but … - any ideas?
If I look in the src
folder below Maker PlayGround Device
in the libdeps\attiny85
folder within .pio
under my project (below) (but why all the references to Adafruit libraries??)
I can see the library I am using but this seems to have an issue opening the .h file - is this getting closer to the problem? - I don’t understand how to respond to the ‘Please update your includeOPath’
Here’s an image of the above
Time passes
I think I corrected the issue above by right clicking the error message and (can’t exactly remember now) updated the include path - I think. Anyway this looks different now, the error message and squiggle have gone
But I am still left with the ‘Remote branch not found’ error below on build.
* Executing task in folder 221022-113635-attiny85: C:\Users\Peter\.platformio\penv\Scripts\platformio.exe run
Processing attiny85 (platform: atmelavr; board: attiny85; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------Library Manager: Installing git+https://github.com/adafruit/Adafruit_L3GD20_U.git#1.1.0
git version 2.38.1.windows.1
Cloning into 'C:\Users\Peter\.platformio\.cache\tmp\pkg-installing-_x0wsrjd'...
warning: Could not find remote branch 1.1.0 to clone.
fatal: Remote branch 1.1.0 not found in upstream origin
Error: VCS: Could not process command ['git', 'clone', '--recursive', '--depth', '1', '--branch', '1.1.0', 'https://github.com/adafruit/Adafruit_L3GD20_U.git', 'C:\\Users\\Peter\\.platformio\\.cache\\tmp\\pkg-installing-_x0wsrjd']
* The terminal process "C:\Users\Peter\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.