https://www.thethingsnetwork.org/docs/devices/arduino/api/cayennelpp.html
Have you looked at the standard "Basic_library_TTN" sketch?
Surely, all you need is something like this?
(Obviously, replace the values with your variables)
#include <CayenneLPP.h>
CayenneLPP lpp(51);
lpp.reset();
lpp.addTemperature(1, 22.5);
lpp.addBarometricPressure(2, 1073.21);
lpp.addGPS(3, 52.37365, 4.88650, 2);
And the LMIC version of this
ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
Also, don’t forget to change the payload function to “Cayenne”
N.B. I’ve put some example code for the Heltec (V1) in post 123 here
But this would be better perhaps?
https://www.thethingsnetwork.org/labs/story/heltec-lorawan-gps-quick-start
Also, this was created about the Heltec