First time on here and new to Arduino programming, hoping to get some help or advice.
It looks like Atlas Scientific has been changing the pH stamp commands with each new version. I am using version 3.0, the latest version, in which the data sheet says the output can return up to 12 ASCII characters. According the the sellers instructional video, the null command is used to make an LED blink on the pH stamp (
), and from reading forums like this I have learned it is also needed to make an array (no idea why). I finally have my Arduino Uno displaying readable text on the serial monitor using a slight variation from the sample code provided by Atlas (as it looks like you guys have been discussing on here). The problem is that the data I am receiving does not appear to be pH readings, I get continous lines (in the serial monitor) of:
...
base: 0acid: 2012.91
base: 0acid: 2012.91
base: 0acid: 2012.91
base: 0acid: 2012.91
...
Here is the code I am using (not sure how to shrink it down like you guys are doing):
#include <NewSoftSerial.h> //this will let the software take advantage of the "newsoftserial" library.
NewSoftSerial mySerial = NewSoftSerial(2, 3); //setup and rename soft uart.
// RX|TX
void setup(){
mySerial.begin(38400);
Serial.begin(38400);
}
void loop() {
mySerial.print('r'); //take a reading from the sensor, end with carriage return
mySerial.print(13,BYTE);
delay(5000); //delay to read serial monitor
int holding;
int i;
char stamp_data[25];
if(mySerial.available() > 3) { //if we see the more then three bytes have been received by the Arduino
holding=mySerial.available(); //lets read how many bytes have been received
for(i=1; i <= holding;i++){ //we make a loop that will read each byte we received
stamp_data
= mySerial.read(); //and load that byte into the stamp_data array
}
for(i=1; i <= holding;i++){ //we now loop through the array
Serial.print(stamp_data); //printing each byte we recived through the hardware UART
}
Serial.println(""); //once we finished, we print a nul char with the <CR><LF> command.
}
}
Any help?