Thanks for the help so far.
inData_Ph is the name of an array. Without the brackets and index, it is a pointer. ph_led_on is an integer. You can't compare the two. That's the error you mentioned.
How is this done? Im very new to this.Ive been taking bits and pieces of others peoples codes to try and get this to work.
Serial1.flush();
Do you know what this does? If not, why are you using it?
I don't know what it means but when i take it away the data that i get on the GLCD is jumbled.
when i verify i get this message in the compiler
PH_TEMP_TEST_control.cpp: In function 'void loop()':
PH_TEMP_TEST_control:47: error: ISO C++ forbids comparison between pointer and integer
PH_TEMP_TEST_control:69: error: ISO C++ forbids comparison between pointer and integer
PH_TEMP_TEST_control:70: error: expected `)' before 'ph'
my code with small changes
#include <glcd.h> // library header
#include "fonts/Arial14.h" // proportional font
#include "fonts/SystemFont5x7.h" // system font
#include "bitmaps/rob2.h" // bitmap
float Ph_val = 0.0;
char inData_Ph[15];
char string_Ph[4];
int led = 7;
int led_on= 26.0; //Turn on the heater at this temp
int led_off_temp = 28.5; //Turn off heater at this temp
int ph = 6;
int led_on_ph= 5.00; //Turn on the Solinoid at this PH
int led_off_ph = 4.00; //Turn off the Solinoid at this PH
void toggle(int Temp)
{
if (digitalRead(Temp) == HIGH,DEC)
digitalWrite(Temp, LOW);
else
digitalWrite(Temp, HIGH);
}
void setup()
{
pinMode(led, OUTPUT);
pinMode(ph, OUTPUT);
Serial.begin(38400);
Serial.println("Ready");
Serial1.begin(38400); // pH stamp
GLCD.Init(NON_INVERTED); // initialise the library
GLCD.ClearScreen();
GLCD.DrawBitmap(rob2, 32,0, BLACK); //draw the bitmap at the given x,y position
delay(2000);
GLCD.ClearScreen();
GLCD.SelectFont(System5x7);
}
void loop()
{
float Tank = map(analogRead(0),250,700,14,441); // analog pin reads 250-700, corresponds to 1.4C to 44.1C
float Sump = map(analogRead(5),250,700,14,441); // analog pin reads 250-700, corresponds to 1.4C to 44.1C
Tank /= 10.0; // divide by 10; map() uses integers
Sump /= 10.0; // divide by 10; map() uses integers
if(Tank < led_on){ // turn heater on if temp is below heater_on_temp
digitalWrite(led, HIGH);
}
if(inData_Ph > led_on_ph){ //Turn on the Solinoid at this PH
digitalWrite(ph, HIGH);
}
Serial1.println("c");
Serial1.print(13,BYTE);
delay(500);
if (Serial1.available() > 0)
{
for (int i=0;i<4;i++) {
inData_Ph = char(Serial1.read());
- }*
- }*
sscanf(inData_Ph, "%*3c%s ", string_Ph);
- Serial1.flush();*
- if (atoi(string_Ph) != 0) {*
- Ph_val = atof(string_Ph);*
- }*
- if(Tank> led_off_temp){ //turn heater off if temp is above heater_off_temp*
- digitalWrite(led, LOW);*
- if(inData_Ph < led_off_ph){ //Turn off the Solinoid at this PH *
- digitalWrite(led ph, LOW);*
- }*
- Serial.print("Main Temp: "); *
- Serial.println(Tank);*
- Serial.print("Sump Temp: "); *
- Serial.println(Sump); *
- Serial.print("PH: [");*
- Serial.print(inData_Ph);*
- Serial.println("]");*
- delay(2000); *
- GLCD.CursorTo(0,0);*
- GLCD.Puts("Temp:Tank:");*
- GLCD.print(Tank);*
- GLCD.Puts("'C");*
- GLCD.CursorTo(5,1);*
- GLCD.Puts("Sump:");*
- GLCD.print(Sump);*
- GLCD.Puts("'C");*
- GLCD.CursorTo(0,2);*
- GLCD.Puts("Ph:");*
- GLCD.print(inData_Ph);*
- }*
}