Thanks for all your help,
I changed the '1' to 1 and '2' to 2 with no change.
In the last ditch attempt,
I've added my full code
/***************************************************
****************************************************/
#include <Adafruit_MAX31865.h>
//#include <OneWire.h>
//#include <DallasTemperature.h>
// CODE RELATES TO THE LM35 - DS18B20
// Data wire is conntec to the Arduino digital pin 9
//#define ONE_WIRE_BUS 9
// Setup a oneWire instance to communicate with any OneWire devices
//OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature sensor
//DallasTemperature sensors(&oneWire);
// CODE RELATES TO THE PT100 - MAX31865
// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13);
// use hardware SPI, just pass in the CS pin
//Adafruit_MAX31865 max = Adafruit_MAX31865(10);
// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF 430.0
// The 'nominal' 0-degrees-C resistance of the sensor
// 100.0 for PT100, 1000.0 for PT1000
#define RNOMINAL 100.0
//SSR
int ssrDirection = 9;
int ssrPulse = 8;
// RGB LED
int ledBlue = 7;
int ledGreen = 6;
int ledRed = 5;
//redLED
int relayOpen = 4;
//greenLED
int relayClose = 3;
//yellowLED
int pulseMotor = 2;
// delay used throughout the program
int delayPeriod = 50;
// time motor will be on to close ball valve
int motorPeriodclose = 30;
// time motor will be on to open ball valve
int motorPeriodopen = 20;
// Relates to Serial Read
int incomingByte = 0;
void setup() {
// sensors.begin();
Serial.begin(115200);
max.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
pinMode(ssrPulse, OUTPUT);
pinMode(ssrDirection, OUTPUT);
pinMode(ledBlue, OUTPUT); //RGB
pinMode(ledGreen, OUTPUT); //RGB
pinMode(ledRed, OUTPUT); //RGB
pinMode(relayOpen, OUTPUT); // redLED
pinMode(relayClose, OUTPUT); // greenLED
pinMode(pulseMotor, OUTPUT); // yellowLED
}
void loop() {
// Call sensors.requestTemperatures() to issue a global temperature and Requests to all devices on the bus
// sensors.requestTemperatures();
// Serial.print("A");
// Serial.print(sensors.getTempCByIndex(0));
// delay(delayPeriod);
uint16_t rtd = max.readRTD();
float ratio = rtd;
ratio /= 32768;
Serial.print("B"); Serial.println(max.temperature(RNOMINAL, RREF));
// Relates to reading from Labview to manually control the Arduino
while (Serial.available()>0)
{
// read the incoming byte
byte incomingByte = Serial.read();
Serial.println(incomingByte);
// Open the valve manually
if (incomingByte == 1)
{
Serial.println( "Open" );
digitalWrite(relayOpen, HIGH);
digitalWrite(relayClose, LOW);
digitalWrite(ssrDirection, HIGH);
digitalWrite(pulseMotor, HIGH);
}
// Close the valve manually
else if (incomingByte == 2)
{
Serial.println( "Close" );
digitalWrite(relayOpen, LOW);
digitalWrite(relayClose, HIGH);
digitalWrite(ssrDirection, LOW);
digitalWrite(pulseMotor, HIGH);
}
}
// If the temperature is less than 26 degrees C
// SSR_Direction = change direction of relay to close valve
// SSR_Pulse = pulse motor closed
// RGB = flash the blue light (too cold)
// LEDs = flash the yellow LED
if (max.temperature(100, RREF) < 26)
{
digitalWrite(relayOpen, LOW);
digitalWrite(relayClose, HIGH);
digitalWrite(ssrDirection, LOW);
digitalWrite(pulseMotor, HIGH);
delay(delayPeriod);
digitalWrite(pulseMotor, LOW);
delay(delayPeriod);
digitalWrite(ssrPulse, HIGH);
delay(motorPeriodclose);
digitalWrite(ssrPulse, LOW);
delay(motorPeriodclose);
digitalWrite(ledBlue, HIGH);
delay(delayPeriod);
digitalWrite(ledBlue, LOW);
delay(delayPeriod);
}
// If the temperature is less than and including 28 degrees C
// SSR_Direction = direction of last transition, no effect as pulse is off
// SSR_Pulse = off
// RGB = flash the green light (perfect)
else if (max.temperature (100, RREF) <= 28)
{
digitalWrite(ledGreen, HIGH);
delay(delayPeriod);
digitalWrite(ledGreen, LOW);
delay(delayPeriod);
}
// If the temperature is above 28 degrees C
// SSR_Direction = change direction of relay to open valve
// SSR_Pulse = pulse motor open
// RGB = flash the red light (too hot)
// LEDs = flash the yellow LED
else
{
digitalWrite(relayOpen, HIGH);
digitalWrite(relayClose, LOW);
digitalWrite(ssrDirection, HIGH);
digitalWrite(pulseMotor, HIGH);
delay(delayPeriod);
digitalWrite(pulseMotor, LOW);
delay(delayPeriod);
digitalWrite(ssrPulse, HIGH);
delay(motorPeriodopen);
digitalWrite(ssrPulse, LOW);
delay(motorPeriodopen);
digitalWrite(ledRed, HIGH);
delay(delayPeriod);
digitalWrite(ledRed, LOW);
delay(delayPeriod);
}
}
I'm wondering if you could get the same effect of driving some pins high or low when it receives the 1/2?
Thanks in advance...``