When you created the PlatformIO project, something seem to have gone wrong. It looks as if you have copied your Arduino code into the PlatformIO template of main.cpp
without emptying it first. Now you have two setup()
and two loop()
functions.
To fix it delete the first six lines. Possibly there a stray closing brace }
somewhere that needs to be deleted as well.
Furthermore I strongly recommend you rearrange your code such that all #include
are before any declarations such as const char apn[] ...
or TinyGsm modem(SerialAT);
.