Your Gateway to Embedded Software Development Excellence — PlatformIO latest documentation in general and especially Redirecting... as I have linked above. Also the FAQ. There are also loads of example projects.
You may also find it interesting to add lib_extra_dirs
(docs) to your platformio.ini
configuration as e.g.
[env]
; default arduino IDE library path for windows
lib_extra_dirs = ${sysenv.HOMEDRIVE}${sysenv.HOMEPATH}\Documents\Arduino\libraries
this will make all your previously installed Arduino IDE libraries visible PlatformIO, though it is recommended to do per-project library management via lib_deps
to avoid global state.
Please paste code as text in Markdown format so that people can simply copy paste them.
I have no problems compiling this code in PlatformIO with
platformio.ini
[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_deps =
Adafruit SSD1306
Adafruit GFX Library
src\main.cpp
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Fonts/FreeSerif9pt7b.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
Serial.begin(115200);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
delay(2000);
display.clearDisplay();
display.setFont(&FreeSerif9pt7b);
display.setTextColor(WHITE);
display.setCursor(5, 15);
// Display static text
display.println("28 May, 4:22pm");
display.println("23C, 0% Hum");
display.println("Hello world!");
display.display();
}
void loop() { }