PlatformIO Community

How to include matplotlib.h?

Hello,

I have a project in which I read out the Sensor Data of a Motor via an Arduino Uno and a CAN Bus Shield.
The CAN Communication works fine and I can read the Data via the Serial Monitor of the Arduino.
For further analysis of the motor behavior, I want to plot and log the Sensor Data, that I recieved of the Serial Com.

I want to to this with the matplotlib libary for C++. I always get an include error.
grafik

I don’t understand, how to include that in the platform.ini.

; 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:uno]
platform = atmelavr
board = uno
framework = arduino
lib_deps = 
	mike-matera/ArduinoSTL@^1.3.3
	devinaconley/Plotter@^2.4.1
monitor_speed = 115200
Build_flags= 
	-Idir C:\Users\someone\vcpkg

I downloaded the Matplotlib via vspkg for Windows (I am using Windows).

Thank you

No way on earth can you run Python or Matplotlib on an 8-bit microcontroller with 2kB of RAM and 32kB of flash, which I see you are attempting to do from your platformio.ini. There seem to be fundamental misunderstandings here.

What you can do is create a new native desktop program, with C++ or rather more easily, a direct Python script, that accepts the data sent from the microcontroller via serial, and plots them.

I strongly recommand just writing a Python script for this on the desktop side. You may use GitHub - lava/matplotlib-cpp: Extremely simple yet powerful header-only C++ plotting library built on the popular matplotlib and friends, and even with PlatformIO, by using the platform = native and a pre-installed compiler (like from MinGW), but that is just waaay more work than writing a few lines of Python.