GY-63_MS5611/libraries/Multiplex/examples/Multiplex_softwareSerial/Multiplex_softwareSerial.ino

69 lines
1.1 KiB
Arduino
Raw Normal View History

2021-01-29 06:31:58 -05:00
//
// FILE: Multiplex_softwareSerial.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// DATE: 2021-01-17
2021-09-14 11:02:45 -04:00
2021-01-29 06:31:58 -05:00
#include "Multiplex.h"
2021-08-10 16:25:19 -04:00
#include <SoftwareSerial.h>
2021-01-29 06:31:58 -05:00
2021-09-14 11:02:45 -04:00
2021-01-29 06:31:58 -05:00
// one multiplexer
Multiplex mp;
2021-09-14 11:02:45 -04:00
2021-01-29 06:31:58 -05:00
// three serial outputs
SoftwareSerial Serial_A(-1, 8);
SoftwareSerial Serial_B(-1, 9);
SoftwareSerial Serial_C(-1, 10);
2021-09-14 11:02:45 -04:00
2021-01-29 06:31:58 -05:00
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial_A.begin(19200);
Serial_B.begin(19200);
Serial_C.begin(19200);
2021-12-22 06:37:31 -05:00
2021-01-29 06:31:58 -05:00
mp.add(&Serial_A);
mp.add(&Serial_B);
mp.add(&Serial_C);
2021-12-22 06:37:31 -05:00
2021-01-29 06:31:58 -05:00
for (int i = 0; i < mp.count(); i++)
{
Serial.print("isEnabled ");
Serial.print(i);
Serial.print(":\t");
Serial.println(mp.isEnabled(i));
}
int n = mp.println("hello world");
Serial.print("count: ");
Serial.println(n);
2021-09-14 11:02:45 -04:00
mp.disableStream(&Serial_B);
2021-08-10 16:25:19 -04:00
for (int i = 0; i < mp.count(); i++)
{
Serial.print("isEnabled ");
Serial.print(i);
Serial.print(":\t");
Serial.println(mp.isEnabled(i));
}
2021-12-22 06:37:31 -05:00
2021-08-10 16:25:19 -04:00
mp.println("\nThis should only print on Serial_A and Serial_C\n");
mp.println("Done...\n");
2021-01-29 06:31:58 -05:00
}
2021-09-14 11:02:45 -04:00
2021-01-29 06:31:58 -05:00
void loop()
{
}
// -- END OF FILE --
2021-12-22 06:37:31 -05:00