Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Adafruit_NeoPixel.h>
- #include <OneWire.h>
- #include <DallasTemperature.h>
- #include <Adafruit_GFX.h>
- #include <Adafruit_ILI9341.h>
- #include <SPI.h>
- #include <Timers.h>
- #define MS9700 A0
- #define TFT_DC 9
- #define TFT_CS 10
- float temp;
- Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
- Timer oiltt; //timer czujnika oleju
- Timer watertt; //timer czujnika wody
- OneWire oneWire(A5); // ds18b20 podłączenie do A5
- DallasTemperature sensors(&oneWire); //Przekazania informacji do biblioteki
- Adafruit_NeoPixel rpmled = Adafruit_NeoPixel(16, A0, NEO_GRB + NEO_KHZ800);
- void setup() {
- Serial.begin(9600);
- analogReference(EXTERNAL);
- sensors.begin(); //Inicjalizacja czujnikow
- rpmled.begin(); //Inicjalizacja paska led
- tft.begin(); //inicjalizacja LCD
- oiltt.begin(1000);
- watertt.begin(750);
- }
- void loop() {
- oiltemp();
- watertemp();
- }
- void oiltemp(){//MCP9700
- if (oiltt.available())
- {
- int sensorValue = analogRead(MS9700); // pomiar temperatury
- float temp = sensorValue * (0)*3.3/1024.0;
- oiltt.restart();
- }
- tft.print("Oil:");
- tft.setCursor(220, 150); //ustalenie pozycji
- tft.print(temp);
- }
- void watertemp(){ //ds18b20
- if (watertt.available())
- {
- sensors.requestTemperatures(); //pomiar temperatury
- watertt.restart();
- }
- tft.print("Water:");
- tft.setCursor(5, 20); //ustalenie pozycji
- tft.print(sensors.getTempCByIndex(0));
- }
- //void rpm() //16LED
- //void oilpress()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement