try sending

This commit is contained in:
interfisch 2021-03-25 21:05:13 +01:00
parent 7f01223588
commit 9d3ccf9040
1 changed files with 8 additions and 2 deletions

View File

@ -5,7 +5,8 @@ int vis_textsize=12; //copy from Visualization class
//String logfile_name="LOG00008_rumfahren_neu.TXT";
String logfile_name="LOG00180_random.TXT";
boolean useSerial=false; //false=read from csv log, true=read from serial port
boolean useSerial=true; //false=read from csv log, true=read from serial port
String serial_port="COM3";
Serial serial;
String serialString=""; //last read string
int serial_endchar=10; //10=ASCII Linefeed
@ -74,11 +75,14 @@ void setup() {
if (useSerial) {
printArray(Serial.list());
// Open the port you are using at the rate you want:
serial = new Serial(this, Serial.list()[0], 9600);
serial = new Serial(this, serial_port, 115200);
serial.clear();
// Throw out the first reading, in case we started reading
// in the middle of a string from the sender.
println("readUntil");
serialString = serial.readStringUntil(serial_endchar);
println("read:"+serialString);
serialString = null;
}else{
logdata = loadTable(logfile_name, "header, csv");
@ -189,7 +193,9 @@ void draw() {
if (useSerial) {
while (serial.available() > 0) {
println("readUntilLoop");
serialString = serial.readStringUntil(serial_endchar);
println("read:"+serialString);
if (serialString != null) {
println(serialString);
lastTimeData=nextTime;