I don't think so - we have Serial1 and Serial2 hardware serial.
I'm confused now.
So Serial1 is on Pin TX and RX (AKA A8/A9).
Where would I find Serial2 ?
thanks!
Iām sorry for the misinformation - I was sure we had Serial2 since Iād not heard otherwise, but as BDub mentions, the 2nd UART goes to the LED pins. These pins are broken out on the underside of the Photon, so could be accessed and used in your project.
A future version of the firmware will make it possible to disable the onboard LED and allow you to route the LED signals to other pins, allowing the original LED pins to be used for Serial2.
I hope that this is workable for you and gives you a route forward.
Serial2 is working on the P1 module. Check out the feature/serial2
branch here:
https://github.com/spark/firmware/tree/feature/serial2
I just merged the latest develop
branch with it and tested⦠all is well
This should theoretically work with the Photon as well, but require some mods. I doubt you will want the RGB LED connect to your RX/TX lines all of the time. So you should probably remove the series resistor for the BLUE and GREEN segments to disconnect it.
Also, since itās not tested on Photon yet⦠the code kind of stubs it out of existence here:
https://github.com/spark/firmware/blob/feature/serial2/hal/src/photon/usart_hal.c#L87-L90
Easy to fix that locally though⦠just change line 87 in a number of ways (easiest just == 6 for photon).
As Mat stated youāll have to re-route the RGB functionality to 3 PWM capable pins as well, and use analogWrite() on those pins to keep the appropriate LED colors updated on your user-implemented RGB LED. More details on how to do this coming in the future.
Hereās a little test app I was using if you want to check this out:
#include "application.h"
#include "Serial2/Serial2.h"
SYSTEM_MODE(MANUAL);
uint32_t now = millis();
uint32_t lastFlash = now;
void setup()
{
// RGB.control(true);
pinMode(RGBR, OUTPUT);
// pinMode(RGBG, OUTPUT);
// pinMode(RGBB, OUTPUT);
Serial.begin(9600);
Serial.println("Hi, I'm Serial USB!");
}
void loop()
{
now = millis();
if (now - lastFlash > 100UL) {
lastFlash = now;
digitalWrite(RGBR, !digitalRead(RGBR)); // This blinks the RED segment of the RGB led
// digitalWrite(RGBG, !digitalRead(RGBG));
// digitalWrite(RGBB, !digitalRead(RGBB));
}
if(Serial.available()) {
char c = Serial.read();
if(c == '1') Serial1.begin(9600);
else if(c == '2') Serial2.begin(9600);
else if (c == 'o') Serial1.println("Hi, I'm Serial 1!");
else if (c == 't') Serial2.println("Hi, I'm Serial 2!");
}
if (Serial1.available()) {
char c = Serial1.read();
Serial.write(c);
}
if (Serial2.available()) {
char c = Serial2.read();
Serial.write(c);
}
}
Thanks Brett,
please keep us updated on the Serial2 progress.
I will try this as soon as I have received my first Photons. I donāt really need the LEDs because the Photon will be inside an aluminum case somewhere in a fire truck
I just received my Photon and damn this looks like a million bucks! Love the packaging and the attention to detail on the board compare to the previous Spark
Looks like the Arduino world has some higher standards to meet now
Okay, so how do I access those pins on my standard Photon with headers?
Where would the corresponding pads (for the green / blue) LED = UART2 TX/RX connectors be?
Thanks,
arne
Looking to buy P1 modules, ā out of stock per Particle store.
When will the next batch of P1 modules be available?
Appears I cannot place advance order on line �?