Working on reading serial.

This commit is contained in:
Ricardo
2018-02-13 22:29:30 +00:00
parent 95adfe3c87
commit 7401853115

View File

@@ -58,7 +58,9 @@ int batt_val = 0; // Holds the value of battery voltage
int incomingByte; // Serial incoming byte buffer int incomingByte; // Serial incoming byte buffer
int lines = 0; int lines = 0;
int chars = 0; int chars = 0;
char sentence[68];
String s;
int i;
// Create SoftwareSerial object and designate pins // Create SoftwareSerial object and designate pins
@@ -337,8 +339,15 @@ void read_serial (void) {
if (mySerial.available()) {
// sentence[i] = mySerial.readString();
Serial.print((char)mySerial.read());
}
delay(10);
/*
// Read text from the serial window // Read text from the serial window
incomingByte = mySerial.read(); incomingByte = mySerial.read();
@@ -353,10 +362,7 @@ void read_serial (void) {
display.display(); display.display();
delay(10); delay(10);
// Clear screen to print new message if we reach the end // Clear screen to print new message if we reach the end if(lines == 8){ delay(500); display.clearDisplay();
if(lines == 8){
delay(500);
display.clearDisplay();
display.setTextSize(1); display.setTextSize(1);
display.setTextColor(WHITE); display.setTextColor(WHITE);
display.setCursor(0,0); display.setCursor(0,0);
@@ -364,6 +370,25 @@ void read_serial (void) {
chars = 0; chars = 0;
} }
} }
*/
/*
incomingByte = mySerial.read();
if (incomingByte == '$') {
sentence[0] = incomingByte;
i++;
}
if (incomingByte != '$' && incomingByte != '\r') {
sentence[i] = incomingByte;
i++;
}
if (i == 68) {
display.println(sentence);
display.display();
}
*/
} }