Trouble Accessing Pi's RX and TX With Serial1

For my own sanity, I used a breakout board and connected my Pi Hat to a Photon and it was working great with the Serial1 code. Can’t wait to be able to do this from my Pi!


String sensorstring = "initial";

void setup() {
  Serial1.begin(115200); // open serial port 
  sensorstring.reserve(30);
  Particle.variable("sensorstring", sensorstring);
}

void loop() {
   sensorstring = Serial1.readStringUntil('\r');
   Particle.publish("sensorstring", sensorstring);
   delay(30000); // leave sensorstring up for 10 secs

 
}

2 Likes