chup90
11/09/2012, 08:00 AM
hi i have atlas pH stamp, arduino duemilanove.
i want to trigger some LEDs, buzzer,when certain pH is reached. i also want to display the pH reading on LCD display.
Here is what i have:
#include NewSoftSerial.h>
NewSoftSerial LCD(2, 3); // LCD
NewSoftSerial ORP(4, 5); // ORP stamp
NewSoftSerial pH(6, 7);
int ORP_val = 0;
float pH_val = 0.0;
void setup()
{
Serial.begin(9600);
LCD.begin(9600); // LCD
ORP.begin(9600); // ORP stamp
pH.begin(9600); // pH stamp
LCD.print("?f");
LCD.print("?c0");
}
void loop(void)
{
char inData_pH[12];
char string_pH[8];
pH.println("read(26.5)c");
delay(750);
if (pH.available() > 0)
{
for (int i=0;i<13;i++) {
inData_pH[i] = char(pH.read());
}
}
sscanf(inData_pH, "%*3c%s ", string_pH);
pH.flush();
if (atoi(string_pH) != 0) {
pH_val = atof(string_pH);
}
Serial.print("Sensor output: [");
Serial.print(inData_pH);
Serial.println("]");
LCD.print("?y0");
LCD.print("?x00");
LCD.print("pH value: ");
----------------------------------------------------------
It seems that the code use newsoftserial instead of softserial library. any comment?
please help me with the code. any reference would also be really helpful.
this is my first time doing such project.
thanks
i want to trigger some LEDs, buzzer,when certain pH is reached. i also want to display the pH reading on LCD display.
Here is what i have:
#include NewSoftSerial.h>
NewSoftSerial LCD(2, 3); // LCD
NewSoftSerial ORP(4, 5); // ORP stamp
NewSoftSerial pH(6, 7);
int ORP_val = 0;
float pH_val = 0.0;
void setup()
{
Serial.begin(9600);
LCD.begin(9600); // LCD
ORP.begin(9600); // ORP stamp
pH.begin(9600); // pH stamp
LCD.print("?f");
LCD.print("?c0");
}
void loop(void)
{
char inData_pH[12];
char string_pH[8];
pH.println("read(26.5)c");
delay(750);
if (pH.available() > 0)
{
for (int i=0;i<13;i++) {
inData_pH[i] = char(pH.read());
}
}
sscanf(inData_pH, "%*3c%s ", string_pH);
pH.flush();
if (atoi(string_pH) != 0) {
pH_val = atof(string_pH);
}
Serial.print("Sensor output: [");
Serial.print(inData_pH);
Serial.println("]");
LCD.print("?y0");
LCD.print("?x00");
LCD.print("pH value: ");
----------------------------------------------------------
It seems that the code use newsoftserial instead of softserial library. any comment?
please help me with the code. any reference would also be really helpful.
this is my first time doing such project.
thanks