Ви не увійшли.
Сторінки 1
Доброго дня, шановна спільнота.
Прошу допомоги в написанні програмок ...
Сам я щойно сів писати малу прогу для керуванням реле. не можу зрозуміти де помилка..
Modul 2 relay + MAX6675 Switch control themperature
Written by OT 24/07/2021
--- thermocuple connection VCC -5V; GRD -GRD; pin SO -4; pin CS -5; pin SCK -6;
--- RELAY connection - pin -22,23;
--- timer (millis)
*/
#include "max6675.h"
int thermoDO = 4;
int thermoCS = 5;
int thermoCLK = 6;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
#define PIN_R1 22 // pin that controls the RELAY 1
#define PIN_R2 23 // pin that controls the RELAY 2
unsigned long currentTime; // variable for timer MAX chip to stabilise
unsigned long currentTime2; // variable for timer Relay1
unsigned long currentTime3; // variable for timer Relay2
bool RELAYState=0; // variable relay 1
bool RELAYState2=0; // variable relay 2
void setup()
{
Serial.begin(9600);
pinMode(PIN_R1, OUTPUT); // declare pin 22 as output:
pinMode(PIN_R2, OUTPUT); // declare pin 23 as output:
Serial.println("Temperature"); // display of temperature measurement, wait for MAX chip to stabilize
if (millis() - currentTime > 5000)
{
currentTime = millis();
}
}
void loop() {
// basic test, print the current temp
Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
if(millis() - currentTime2 > 5000) // Checking the time for the relay 1
{
currentTime2 = millis(); // Change the state of the relay1 to the opposite
RELAYState=!RELAYState
digitalWrite(PIN_R1, RELAYState);
}
if(millis() - currentTime3 > 8000) // Checking the time for the relay 2
{
currentTime3 = millis(); // Change the state of the relay2 to the opposite
RELAYState2=!RELAYState2
digitalWrite(PIN_R2, RELAYState2);
}
// if temprature goes above 480.0C, turn the relay OFF
if (thermocouple.readCelsius() < 480.00)
{
digitalWrite(PIN_R1, HIGH); // turn the Relay1 Switch ON
digitalWrite(PIN_R2, HIGH); // turn the Relay2 Switch ON
} else {
digitalWrite(PIN_R1, LOW); // turn the Relay1 Switch OFF
digitalWrite(PIN_R2, LOW); // turn the Relay2 Switch OFF
}
}
повідомлення про помилку-
E:ArduinoModul___TC_R millisModul___TempControlModul___TempControl.ino: In function 'void loop()':
Modul___TempControl:52:4: error: expected ';' before 'digitalWrite'
digitalWrite(PIN_R1, RELAYState);
^~~~~~~~~~~~
Modul___TempControl:60:4: error: expected ';' before 'digitalWrite'
digitalWrite(PIN_R2, RELAYState2);
^~~~~~~~~~~~
exit status 1
expected ';' before 'digitalWrite'
Дякую
Неактивний
Сторінки 1