Newbie and having trouble. I am trying to put together a co2 controller. All I need is the code for the k30 c02 sensor and a light on or off sensor. Lcd display and serial with preset ppm settings. Simple with no temp or other sensors just preset readings, light sensor and a relay to control the regulator. I have Parkinson and its hard do things like this. I can do the wiring and have all the stuff but the code escapes me. I tried to paste together a few programs but they either had too much or not enough and they don't compile right. This is some of what I have so far.
#include "kSeries.h"
#include <Wire.h>
#define RELAY_ON 0
#define RELAY_OFF 1
// create a variable for each relay. Each relay is associated with a different digital pin
// In this example digital pin 2 is connected to the relay
#define Relay_1 2 // Arduino Digital I/O (digitalRead and digitalWrite) pin number.
kSeries Sensor1(8, 9); // Initialize a kSeries Sensor with pin 8 as Rx and 9 as Tx
// In this example we are calling the sensor “Sensor1”
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for the arduino native USB port connection
}
Serial.println("AN-216 Example 2: uses the kSeries.h library");
//-------(Initialize Pins so relays are inactive at reset)----
digitalWrite(Relay_1, RELAY_OFF);
//---( THEN set pins as outputs )----
pinMode(Relay_1, OUTPUT);
if (co2_ppm < 780 && co2_ppm > 0) {
// Open valve if CO2 is too low and there is a CO2 reading
digitalWrite(Relay_1, RELAY_ON);
Serial.print("valve 1 on,");
delay(200); // Open valve for 200 milliseconds) if the CO2 level is below
// the set point
digitalWrite(Relay_1, RELAY_OFF);
} else {
digitalWrite(Relay_1, RELAY_OFF);
Serial.print("valve 1 off, ");
}
Serial.println();
delay(30000);
Any help would be appreciated.
Thanks