witam kolegów postanowiłem zrobić sobie termometr do kontroli temperatury płynu chłodzącego mam taki kodzik chciał bym dodatkowo do niego dołożyć 4 diody które zapalały by się w zależności od temperatury 1,40*2,70*3,90*4,100* lecz moja wiedza jest zbyt niska żeby ogarnąć ten kodzik prosił bym o pomoc
Proszę używać znaczników "code"
Kod:
#include <OneWire.h>
#include <DS18B20.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define BACKLIGHT_PIN 3
#define ONEWIRE_PIN 2// Numer pinu do którego podłaczasz czujnik w Arduino
float temperature = 0;
byte address[8] = {0x28, 0xFF, 0x9, 0x2C, 0x4, 0x15, 0x3, 0xB6};// Numer seryjny czujnika
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7);
OneWire onewire(ONEWIRE_PIN);
DS18B20 sensors(&onewire);
void setup(void)
{
Serial.begin(9600);
sensors.begin();
sensors.request(address);
lcd.begin(16,2);
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.setCursor(1,0);
lcd.print("TEMPERATURA :)");
lcd.setCursor(6,1);
lcd.print("WODY ");
delay (8000);
lcd.clear();
}
void loop(void)
{
temperature = sensors.readTemperature(address);
sensors.request(address);
//lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.setCursor(6, 0);
lcd.print(temperature);
lcd.setCursor(12,0);
lcd.print("*C");
delay(10);
}
Proszę używać znaczników "code"