Heating system interface for communication with Arduino and data graphing
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
550 B

  1. #define in1 A0
  2. #define out1 6
  3. float temp1, lectura1;
  4. String estado;
  5. void setup() {
  6. // put your setup code here, to run once:
  7. Serial.begin(9600);
  8. pinMode(in1, INPUT);
  9. }
  10. void loop() {
  11. // put your main code here, to run repeatedly:
  12. lectura1 = analogRead(in1);
  13. temp1 = (lectura1 * 5000 / 1023 / 10) - 40;
  14. Serial.print(temp1);
  15. if(Serial.available()>0){
  16. estado = Serial.readString();
  17. if(estado == "on"){
  18. digitalWrite(out1, HIGH);
  19. }
  20. else if(estado == "off"){
  21. digitalWrite(out1, LOW);
  22. }
  23. }
  24. delay(800);
  25. }