platform-ststm32
platform-ststm32 copied to clipboard
Compile and upload to Arduino Opta is succesfull, but code doesn't run
This simple code has been compiled and uploaded from PlatformIO 6.1.14 (VSCode 1.87.2 on Windows 11) to an Arduino OPTA RS-485, but it doesn't run. It prints nothing and the LED is dark.
#include <Arduino.h>
#ifndef MONITOR_SPEED
#define MONITOR_SPEED 9600
#endif
#include <Arduino.h>
#define LED LED_BUILTIN
void setup() {
pinMode(LED, OUTPUT);
Serial.begin(MONITOR_SPEED);
while(!Serial);
Serial.println("Starting...");
}
void loop() {
digitalWrite(LED, LOW);
delay(1000);
Serial.println("Low");
delay(1000);
digitalWrite(LED, HIGH);
Serial.println("High");
delay(1000);
}
platformio.ini is here:
[env:opta]
platform = ststm32
board = opta
framework = arduino
monitor_speed = 115200
build_flags =
-DMONITOR_SPEED=${this.monitor_speed}
If you try to compile and upload it from Arduino IDE 2.3.2, it works well (prints to the serial console and LED is blinks).
I have had similar experiences with other sketches.