arduino включване на двигател и нагревател(машина за инвертиран сироп)

#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

int pin_nagrevatel=12;
int pin_motor=11;
float temp_low=26;
int temp_find=27;

int inputserial;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
Serial.begin(9600);
pinMode(pin_nagrevatel, OUTPUT);
pinMode(pin_motor, OUTPUT);

sensors.begin();
}

// the loop routine runs over and over again forever:
void loop() {

sensors.requestTemperatures(); // Send the command to get temperatures
float temp1 = sensors.getTempCByIndex(0);

//Kontrol na whodnite komandi
while( Serial.available() > 0 )
{
inputserial = Serial.read();
Serial.println(inputserial);

switch( inputserial)
{
case 48://0
delay (1000);
Serial.println(temp1);
delay (1000);

break;
case 49://1
digitalWrite(pin_nagrevatel, HIGH);
Serial.println("Nagrewatel ON ");
break;
case 50://2
digitalWrite(pin_nagrevatel, LOW);
Serial.println("Nagrewatel OFF ");
break;

case 51://3
digitalWrite(pin_motor, HIGH);
Serial.println("Motor ON ");
break;

case 52://4
digitalWrite(pin_motor, LOW);
Serial.println("Motor OFF ");
break;

};

}//End of while( Serial.available() > 0 )

}

VN:F [1.9.22_1171]
Rating: 3.5/5 (2 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 2 votes)
arduino включване на двигател и нагревател(машина за инвертиран сироп), 3.5 out of 5 based on 2 ratings

Вашият коментар

Вашият email адрес няма да бъде публикуван Задължителните полета са отбелязани с *