Primary Alternative
&& and
&= and_eq
& bitand
| bitor
~ compl
! not
!= not_eq
|| or
|= or_eq
^ xor
^= xor_eq
{ <%
} %>
[ <:
] :>
While and and or make sense,. <%, %>, <:, and :> just do not.
It's tough enough reading multi-dimension array manipulating functions, when the standard symbols are used. I'd just hit the back button if someone posted:
int sum(int a<::>, byte len)
<%
int total = 0;
for(byte b=0; b<len; b++)
<%
total += a<:b:>;
%>
return total;
%>
Thanks for all replies! Currently trying to teach myself coding. I have managed to code what is basically a thermostat. This project is a little time and temperature controller possibly multiple temperatures for set periods of time.
At the moment manual =0 and timed heating =0 so if condition is not met?
The code so far:
#include <Time.h> // includes Time library
#include <TimeAlarms.h> // includes Time Alarms library
#include <dht.h> // includes Temperature and Humidity sensor library
dht DHT; //does what??
#define DHT11_PIN 7 //Temperature and humidity sensor on pin 7
#define relay A0 //relay A0 heating on/off
#define interval 1000 //what for?
byte TempSP = 25; //temperature setpoint
bool Manual = false; //heating set to manual on toggle for manual Auto operation
byte TimedHeating = 0; //heating set to TimedHeating on
void setup()
{ // put your setup code here, to run once:
pinMode(22, OUTPUT); // setting first relay on pin 22
Serial.begin(9600);
setTime(8,29,0,04,11,18); // set time to Saturday 8:29:00am Jan 11 2018
// create the alarms
Alarm.alarmRepeat(7,30,0, MorningSP); // 7:30am every day
Alarm.alarmRepeat(17,45,0,EveningSP); // 5:45pm every day
Alarm.alarmRepeat(dowSaturday,8,30,30,WeeklySP); // 8:30:30 every Saturday
Alarm.timerRepeat(2, Repeat); // timer for every 2 seconds
Alarm.timerRepeat(10, Repeats); // timer for every 10 seconds
}
void loop(){
//needs clock setup to change time and date
//needs timer setup to change timed events
//needs temperature setup to change desired tempSP
//needs manual switch to toggle state of Manual bool
digitalClockDisplay();
Alarm.delay(1000); // write clock display every second
}
void Repeat(){
int chk = DHT.read11 (DHT11_PIN); // check Temperature and humidity every 2 seconds
if((Manual == true)or((DHT.temperature <= TempSP) && (TimedHeating == 1))) //conditions for heating to come on time heating problem as if not true does not doe else
{
digitalWrite(22, HIGH); // relay A0 on digital pin 22
}
else
{
digitalWrite(22, LOW); // relay A0 on digital pin 22
}
}
void MorningSP(){ // functions to be called when an alarm triggers:
Serial.println("TimedHeating: - turn heating off");
//TimedHeating = 0;
}
void EveningSP(){ // functions to be called when an alarm triggers:
Serial.println("TimedHeating: - turn heating on");
//TimedHeating = 1;
}
void WeeklySP(){
Serial.println("Alarm: - its Saturday Morning");
}
void Repeats(){ //10 second timer not used
}
void digitalClockDisplay()
{
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.println();
Serial.print("Current Temperature =");
Serial.println(DHT.temperature);
Serial.print("Humidity =");
Serial.println(DHT.humidity);
Serial.print("Manual =");
Serial.println(Manual);
Serial.print(" or Current Temperature =");
Serial.println(DHT.temperature);
Serial.print(" <= TempSP =");
Serial.println(TempSP);
Serial.print(" and TimedHeating =");
Serial.println(TimedHeating);
}
void printDigits(int digits)
{
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
PaulS:
While and and or make sense,. <%, %>, <:, and :> just do not.
It's tough enough reading multi-dimension array manipulating functions, when the standard symbols are used. I'd just hit the back button if someone posted:
int sum(int a<::>, byte len)
<%
int total = 0;
for(byte b=0; b<len; b++)
<%
total += a<:b:>;
%>
return total;
%>
These date from a time some terminal entry screens did not have the necessary characters to write those glyphs