ARDUINO SOFTWARE VERSION >=1.65 BROKEN SERIAL MONITOR!

Arduino software version = 1.65…1.67
Arduino model = arduino micro.
Operating system = windows 8.1 x64 enterprise.

**error description = ** broken serial monitor!
error trigger = entering text into serial monitor then pressing send button or enter key.
error result = arduino software & serial monitor freeze/lock up & will not close.
Program will not terminate when pressing close button(x) in menubar of serial monitor or arduino software window.

The only way to close the arudino application is to

  1. Load windows task manager. Press keys: control+alt+delete.
  2. Select task manager.
  3. Select tab : processes
  4. Right click : java™ platform se binary (32 bit)
  5. Select from dropdown menu : end task

this error results when working with code that features serial commands, prehaps serialevent(), serialavailable(), or omits while (!Serial).

It is likely related to this is some way…
Can someone please enlighten me as to why this is occuring? And how to prehaps prevent this issue with arduino micro.


steps to generate error (with no serial commands).

  1. Upload examples/blink.ino to arduino micro.
  2. Load tools/serial monitor.
  3. Enter any text into serial monitor text field.
  4. Trigger error: press enter key or press serial monitor send button
    Result = arduino software + arduino serial monitor freeze/lock up.

Note: this error probably relates to the fact the serial.begin is not featured in blink demo. but demonstrates the error.


steps that do not generate error (with serial/softserial commands).

  1. Upload examples/softwareserial/softwareserialexample.ino to arduino micro.
  2. Load tools/serial monitor.
  3. Enter any text into serial monitor text field.
  4. Press enter key or press serial monitor send button
    Result = arduino serial monitor works correctly.
    Sending serial data from the serial monitor with enter key or send button works as intended.

The above software serial example code is working correctly.


can anyone kindly identify why the code below (The source of my frustration!!) is causing this terminal error??
It would be most appreciated!

Source = https://www.atlas-scientific.com/_files/code/ino_files/arduino_ph_sample_code.zip


//this code was written to be easy to understand.
//code efficiency was not considered.
//modify this code as you see fit.
//this code will output data to the arduino serial monitor.
//type commands into the arduino serial monitor to control the ph circuit.
//this code was written in the arduino 1.6.5 ide
//an arduino uno was used to test this code.

#include <softwareserial.h> //we have to include the softwareserial library, or else we can’t use it.
#define rx 2 //define what pin rx is going to be.
#define tx 3 //define what pin tx is going to be.

Softwareserial myserial(rx, tx); //define how the soft serial port is going to work.

String inputstring = “”; //a string to hold incoming data from the pc
String sensorstring = “”; //a string to hold the data from the atlas scientific product
Boolean input_stringcomplete = false; //have we received all the data from the pc
Boolean sensor_stringcomplete = false; //have we received all the data from the atlas scientific product
Float ph; //used to hold a floating point number that is the ph.

Void setup() { //set up the hardware
Serial.begin(9600); //set baud rate for the hardware serial port_0 to 9600
Myserial.begin(9600); //set baud rate for software serial port_3 to 9600
Inputstring.reserve(10); //set aside some bytes for receiving data from the pc
Sensorstring.reserve(30); //set aside some bytes for receiving data from atlas scientific product
}

Void serialevent() { //if the hardware serial port_0 receives a char
Char inchar = (char)serial.read(); //get the char we just received
Inputstring += inchar; //add it to the inputstring
If (inchar == ‘\r’) {
Input_stringcomplete = true; //if the incoming character is a , set the flag
}
}

Void loop() { //here we go…

If (input_stringcomplete) { //if a string from the pc has been received in its entirety
Myserial.print(inputstring); //send that string to the atlas scientific product
Inputstring = “”; //clear the string
Input_stringcomplete = false; //reset the flag used to tell if we have received a completed string from the pc
}

If (myserial.available() > 0) { //if we see that the atlas scientific product has sent a character.
Char inchar = (char)myserial.read(); //get the char we just received
Sensorstring += inchar;
If (inchar == ‘\r’) {
Sensor_stringcomplete = true; //if the incoming character is a , set the flag
}
}

If (sensor_stringcomplete) { //if a string from the atlas scientific product has been received in its entirety
Serial.println(sensorstring); //send that string to the pc’s serial monitor
Ph = sensorstring.tofloat(); //convert the string to a floating point number so it can be evaluated by the arduino

If (ph >= 7.0) { //if the ph is greater than or equal to 7.0
Serial.println(“high”); //print “high” this is demonstrating that the arduino is evaluating the ph as a number and not as a string
}

If (ph <= 6.999) { //if the ph is less than or equal to 6.999
Serial.println(“low”); //print “low” this is demonstrating that the arduino is evaluating the ph as a number and not as a string
}

Sensorstring = “”; //clear the string:
Sensor_stringcomplete = false; //reset the flag used to tell if we have received a completed string from the atlas scientific product
}
}


Arduino_pH_sample_code.ino (4.24 KB)