Library depends on arduino.h but cant include it


#1

I have been working on this school project for a couple of weeks. After making a lot of changes I ran into a problem. The project is made up out of 2 parts the transmitter and receiver. This means I got to projects in PlatformIO. Currently I am sharing things via a separate Lib folder. This is so I can easily add new commands and don’t need to do duplicate work. The problem I have run into is with the variable Byte. I use the variable type byte to store my commands in hexadecimals. This only works if I include the Arduino.h, but the library/Lib folder will give errors if I include the arduino.h in the Lib folder. But if I don’t it wont recognize byte as a variable type. Does anyone know a solution to this problem?
Source code can be provided.


#2

How to you include the Arduino.h file exactly (#include <Arduino.h> in the library header? copying the file?) and what error do you get?


#3

Replace usage of byte with uint8_t and you won’t need to include arduino.h. Arduino style libs have a very weird choice of primitives, just ignore that and learn best practices.