Working on reading serial.
This commit is contained in:
@@ -58,7 +58,9 @@ int batt_val = 0; // Holds the value of battery voltage
|
||||
int incomingByte; // Serial incoming byte buffer
|
||||
int lines = 0;
|
||||
int chars = 0;
|
||||
|
||||
char sentence[68];
|
||||
String s;
|
||||
int i;
|
||||
|
||||
|
||||
// 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
|
||||
incomingByte = mySerial.read();
|
||||
|
||||
@@ -353,10 +362,7 @@ void read_serial (void) {
|
||||
display.display();
|
||||
delay(10);
|
||||
|
||||
// Clear screen to print new message if we reach the end
|
||||
if(lines == 8){
|
||||
delay(500);
|
||||
display.clearDisplay();
|
||||
// Clear screen to print new message if we reach the end if(lines == 8){ delay(500); display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(0,0);
|
||||
@@ -364,6 +370,25 @@ void read_serial (void) {
|
||||
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();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user