Ok, so I have numbers being sent to the spark core through serial communication, but I am not getting the spark core to write what is supposed to be written to the usb through serial communication. Here is the code that is being written to the core:
#include "application.h"
#include "Serial2/Serial2.h"
int incomingByte = 0;
void setup() {
// Spark.function("sendData", sendData);
Serial.begin(4800);
Serial1.begin(4800);
Serial2.begin(4800);
}
void loop() {
// if(Serial1.available())
// Serial.write(Serial1.read());
static int counter1;
// Serial.print("Serial Data from pcb: ");
// Serial.write(counter1);
if (Serial1.available() > 0)
{ incomingByte = Serial1.read();Serial.print("Serial1");}
if (Serial2.available() > 0)
{ incomingByte = Serial2.read();Serial.print("Serial2");}
// say what you got:
Serial.print("-I received: ");
Serial.println(incomingByte, DEC);
delay(1000);
//Serial.write(counter1);
//Serial.print("Jason");
/*counter1++;
if (counter1>9 ){counter1=0;}*/
}
When I program this on the core, and I use a program called realterm to look at the serial communications, all I see is:
-I recieved: 0
which is weird because there should be stuff that is getting written to both serial1 and serial2. I know I haven’t provided a ton of information but I was wondering if anyone can notice any problems with what is written in the code. Help is greatly appreciated. Thank you!