Circuit Playground Classic and SloftwareSerial
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Circuit Playground Classic and SloftwareSerial

by fredless on Wed Apr 28, 2021 4:01 pm

I'm struggling to get an XBee module working properly with a Circuit Playground Classic. If I use generic Arduino code, it works fine. If I use a standard CP function like CircuitPlayground.lightSensor() it also works.

But if I run CircuitPlayground.begin() to reset the Circuit Playground, the XBee via SoftwareSerial no longer transmits. I've tried it both before and after the serial.begin functions. Any ideas?


working code:
#include <Adafruit_CircuitPlayground.h>
#include<SoftwareSerial.h> // header file of software serial port

SoftwareSerial mySerial(9, 10); // define software serial port name as mySerial and pin 9 as RX and pin 10 as TX

int lightSensorPin = A5; // Circuit Playground light sensor is Analog Pin A5
int value;

void setup() {
//CircuitPlayground.begin(); // does not work with SoftwareSerial!

void loop() {
//value = CircuitPlayground.lightSensor(); // this works even without CircuitPlayground.begin()
value = analogRead(lightSensorPin);
Serial.print("Light Sensor: ");


Posts: 2
Joined: Tue Oct 16, 2012 2:07 pm

Re: Circuit Playground Classic and SloftwareSerial

by mikeysklar on Fri Apr 30, 2021 3:18 pm

I've seen this conflict happen before with the CircuitPlayground.begin() knocking out software serial. Do you really need the CircuitPlayground functions in this case? I suppose the alternative would be to use a different device like the Circuit Playground Express which has two hardware serial ports. I do not have a good suggestions for using both the CircuitPlayground built-ins and software serial simultaniously on the CircuitPlayground Classic.

Posts: 4508
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.