poniedziałek, 23 marca 2015

Arduino i wyświetlacz ILI9340 / 9341 cz.2

Tak jak wcześniej obiecałem dziś do naszego wyświetlacza dodamy popularny czujnik Temperatury DS18B20 firmy Dallas.
Czujniki sprzedawane są w 2 wariantach w obudowie zwykłej oraz wodoodpornej.






Co będzie nam potrzebne

1.Dowolna płytka Arduino
2.Czujnik temperatury dallas DS18B20
3.Rezystor 4,7k
4.Płytka stykowa
5.Przewody połączeniowe
6.Wyświetlacz ILI9340 lub 9341

Na początek musimy pobrać z sieci 2 potrzebne biblioteki,łatwo je znaleźć w google więc nie podaję linków.

1 biblioteka to
OneWire

2 biblioteka to
DallasTemperature

Biblioteki pobieramy i rozpakowywujemy do katalogu Libraries.

Podłączenie wyświetlacza macie w poprzednim poście ,więc zajmiemy się tylko podłączeniem czujnika DS18B20 a wygląda ono tak:




Gdy mamy wszystko podłączone wgrywamy prosty kod mający za zadanie odczyt temperatury z czujnika i wyświetlanie jej co 1s na naszym wyświetlaczu.


#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
const int intTimePause = 5000;

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9340.h"

#if defined(__SAM3X8E__)
    #undef __FlashStringHelper::F(string_literal)
    #define F(string_literal) string_literal
#endif


#define _sclk 13
#define _miso 12
#define _mosi 11
#define _cs 10
#define _dc 9
#define _rst 8


Adafruit_ILI9340 tft = Adafruit_ILI9340(_cs, _dc, _rst);

void setup ()
 {  
  tft.begin();
   sensors.begin();
 }

void loop()
 { 
  sensors.requestTemperatures();
  
  tft.fillScreen(ILI9340_BLACK);
   tft.setCursor(0, 0);
    tft.setTextColor(ILI9340_RED);  tft.setTextSize(3);
  
     tft.println("");
      tft.print("Temp ");
       tft.println(sensors.getTempCByIndex(0));
       delay(1000);
 }


  
  
  
  
  
  
  
  
  
 
  

tutaj przykład termometru do akwarium z czujnikiem DS18B20 w wersji wodoszczelnej.
/*Autor:
  Tomasz Wasiński
  wasyl2007
  
Termometr akwariowy z alarmem 
  
*/

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9340.h"




#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 3

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

//Podłączenie wyświetlacza ILI9340
#define _sclk 13
#define _miso 12
#define _mosi 11
#define _cs 10
#define _dc 9
#define _rst 8
Adafruit_ILI9340 tft = Adafruit_ILI9340(_cs, _dc, _rst);
 
//bitmapa rybka
 prog_uchar myBit1[] PROGMEM ={

 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x01,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0xc0,0x00,0x00,0x00,0x01,0xf7,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x40,0x00,0x00,0x00,0x03,0xc9,0x80,0x00,0x00,0x00,0x0f
,0x00,0x10,0x40,0x00,0x00,0x00,0x07,0xb3,0x80,0x00,0x00,0x00,0x0f
,0x00,0x10,0x40,0x00,0x00,0x00,0x0f,0x64,0x80,0x00,0x00,0x00,0x0f
,0x00,0x10,0x40,0x00,0x00,0x00,0x16,0xc8,0x80,0x00,0x00,0x00,0x0f
,0x00,0x00,0x80,0x00,0x00,0x00,0x24,0x91,0x00,0x00,0x00,0x00,0x0f
,0x00,0x0d,0x80,0x00,0x00,0x00,0x49,0x27,0x00,0x00,0x00,0x00,0x0f
,0x00,0x07,0x00,0x00,0x18,0x00,0xd2,0x6d,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x43,0xff,0xfc,0x5a,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x70,0x00,0x81,0x00,0x0f,0x92,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x08,0x0f,0x01,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x08,0x19,0x10,0x80,0x00,0x70,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x04,0x31,0x30,0x80,0x00,0x1c,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x84,0x2e,0x3c,0x80,0x08,0x0e,0x00,0x00,0x00,0x80,0x0f
,0x00,0x00,0x88,0x6e,0x38,0x80,0x0c,0x03,0x00,0x00,0x07,0xe0,0x0f
,0x00,0x00,0x78,0x4c,0x18,0x80,0x02,0x01,0xc0,0x00,0x1f,0xb0,0x0f
,0x00,0x00,0x30,0x49,0x00,0x80,0x02,0x00,0xc0,0x00,0x32,0x10,0x0f
,0x00,0x00,0x00,0x51,0x00,0x80,0x02,0x00,0x60,0x00,0x6c,0x30,0x0f
,0x00,0x00,0x00,0x51,0x81,0x00,0x00,0x00,0x30,0x01,0x99,0x90,0x0f
,0x00,0x00,0x00,0x60,0x83,0x00,0x06,0x1c,0x18,0x03,0x37,0x10,0x0f
,0x00,0x00,0x00,0x20,0xe6,0x01,0x03,0x04,0x0c,0x02,0x4c,0x30,0x0f
,0x00,0x00,0x00,0x40,0x3c,0x01,0x00,0x82,0x64,0x05,0x18,0x20,0x0f
,0x00,0x00,0x00,0x40,0x00,0x00,0x80,0x84,0x26,0x08,0x21,0xe0,0x0f
,0x00,0x00,0x00,0xc0,0x00,0x00,0x80,0x84,0x23,0x11,0x46,0x40,0x0f
,0x00,0x00,0x00,0x80,0x00,0x00,0xc1,0x88,0x21,0x11,0x1c,0xc0,0x0f
,0x00,0x00,0x00,0x80,0x00,0x00,0x41,0x0c,0x21,0xa1,0x31,0x80,0x0f
,0x00,0x00,0x00,0x80,0x00,0x00,0x46,0x02,0x44,0xc1,0x61,0x00,0x0f
,0x00,0x00,0x01,0x80,0x00,0x00,0x42,0x01,0x82,0x41,0x0e,0x00,0x0f
,0x00,0x00,0x01,0x00,0x00,0x00,0x61,0x01,0x02,0x41,0x3e,0x00,0x0f
,0x00,0x00,0x01,0x00,0x00,0x00,0x21,0x02,0x22,0x61,0xec,0x00,0x0f
,0x00,0x00,0x01,0x00,0x00,0x00,0x22,0x02,0x12,0x21,0x10,0x00,0x0f
,0x00,0x00,0x01,0x00,0x00,0x00,0x26,0x06,0x12,0x20,0x20,0x00,0x0f
,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x0c,0x14,0x22,0x80,0x00,0x0f
,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x30,0x30,0x23,0x00,0x00,0x0f
,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x62,0x22,0x80,0x00,0x0f
,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0xc2,0x22,0x40,0x00,0x0f
,0x00,0x00,0x01,0x00,0x00,0x00,0x22,0x00,0x86,0x43,0x20,0x00,0x0f
,0x00,0x00,0x01,0x00,0x02,0x00,0x41,0x00,0x84,0x42,0xa0,0x00,0x0f
,0x00,0x00,0x01,0x00,0x03,0xe0,0x41,0x00,0xc8,0x84,0x70,0x00,0x0f
,0x00,0x00,0x01,0x00,0x01,0x80,0x41,0x00,0x90,0x86,0x38,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x81,0x05,0x8c,0x00,0x0f
,0x00,0x00,0x00,0x80,0x02,0x00,0x82,0x01,0x01,0x04,0xc4,0x00,0x0f
,0x00,0x00,0x00,0x80,0x06,0x00,0x86,0x06,0x02,0x84,0x36,0x00,0x0f
,0x00,0x00,0x00,0x00,0x04,0x00,0x0c,0x40,0x04,0x02,0x1a,0x00,0x0f
,0x00,0x00,0x00,0x40,0x0c,0x01,0x00,0xa0,0x08,0x49,0x06,0x00,0x0f
,0x00,0x00,0x00,0x00,0x18,0x00,0x01,0x98,0x00,0x28,0xc3,0x00,0x0f
,0x00,0x00,0x00,0x20,0x30,0x00,0x03,0x4c,0x00,0x24,0x61,0x00,0x0f
,0x00,0x00,0x00,0x10,0x60,0x00,0x07,0x34,0x00,0x12,0x31,0x00,0x0f
,0x00,0x00,0x00,0x0f,0xc0,0x00,0x0c,0x9a,0x00,0x09,0x19,0x80,0x0f
,0x00,0x00,0x00,0x07,0x80,0x00,0x1a,0x4f,0x00,0x0c,0x8d,0x80,0x0f
,0x00,0x00,0x00,0x01,0x80,0x00,0x15,0x67,0x00,0x06,0x43,0x80,0x0f
,0x00,0x00,0x00,0x00,0xc0,0x00,0x05,0x23,0x00,0x03,0xa1,0x00,0x0f
,0x00,0x00,0x00,0x00,0x60,0x00,0x0a,0x91,0x00,0x01,0xfb,0x00,0x0f
,0x00,0x00,0x00,0x00,0x30,0x00,0x02,0x89,0x00,0x00,0x7f,0x00,0x0f
,0x00,0x00,0x00,0x00,0x18,0x00,0x03,0x47,0x00,0x00,0x1e,0x00,0x0f
,0x00,0x00,0x00,0x00,0x03,0xff,0xfd,0x62,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x1f,0xae,0xa2,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x03,0xa7,0x96,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x03,0x95,0xcc,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x01,0xf8,0xf8,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
};
//bitmapa termometr
 prog_uchar myBit2[] PROGMEM ={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xc0,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xf8,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x3e,0x0f
,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x0f,0x0f
,0x00,0x7f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x03,0x8f
,0x00,0xe1,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0xcf
,0x00,0xe1,0xc0,0x0f,0x80,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x0f
,0x00,0x73,0x80,0x78,0x78,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x0f
,0x00,0x3f,0x01,0xe0,0x38,0x00,0x00,0x00,0x03,0xc0,0x20,0x00,0x0f
,0x00,0x1e,0x03,0xc0,0x18,0x00,0x00,0x00,0x07,0x80,0xc0,0x00,0x0f
,0x00,0x00,0x07,0xc0,0x18,0x00,0x00,0x00,0x0f,0x01,0x80,0x00,0x0f
,0x00,0x00,0x0f,0x80,0x00,0x00,0x00,0x00,0x1e,0x7f,0x80,0x00,0x4f
,0x00,0x00,0x0f,0x80,0x00,0x00,0x00,0x00,0x7c,0x0f,0xf0,0x03,0xcf
,0x00,0x00,0x0f,0x80,0x00,0x00,0x00,0x00,0x78,0x0c,0x1c,0x0f,0x8f
,0x00,0x00,0x0f,0x80,0x00,0x00,0x00,0x00,0xf0,0x18,0x00,0x1f,0x0f
,0x00,0x00,0x0f,0x80,0x00,0x00,0x00,0x01,0xe0,0x30,0x00,0x1e,0x0f
,0x00,0x00,0x0f,0x80,0x20,0x00,0x00,0x03,0xc0,0x70,0x00,0x3c,0x0f
,0x00,0x00,0x07,0xc0,0xc0,0x00,0x00,0x0f,0x80,0xe0,0x00,0x78,0x0f
,0x00,0x00,0x03,0xf3,0x80,0x00,0x00,0x0f,0x01,0xc0,0x00,0xf0,0x0f
,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x3c,0x7f,0xc0,0x01,0xe0,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x0f,0xf8,0x03,0xc0,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x0e,0x04,0x07,0x80,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x1c,0x00,0x0f,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xc0,0x38,0x00,0x1e,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x70,0x00,0x3c,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0xe0,0x00,0x78,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x31,0xc0,0x00,0xf0,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x3f,0xe0,0x01,0xe0,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x07,0xf8,0x03,0xc0,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x0e,0x00,0x07,0x80,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x1c,0x00,0x0f,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x03,0xc0,0x38,0x00,0x1e,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x70,0x00,0x3c,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0xe0,0x00,0x78,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x1e,0x39,0xc0,0x00,0xf0,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x3c,0x3f,0xe0,0x01,0xe0,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x78,0x07,0xfc,0x03,0xc0,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0xf0,0x0f,0x00,0x07,0x80,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x01,0xe0,0x1e,0x00,0x0f,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x03,0xc0,0x3c,0x00,0x1e,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x07,0x00,0x78,0x00,0x3c,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x0e,0x00,0xf0,0x00,0x78,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x1c,0x1d,0xe0,0x00,0xf0,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x38,0x3f,0xe0,0x01,0xe0,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x70,0x07,0xfc,0x03,0xc0,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0xe0,0x0f,0x00,0x07,0x80,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x01,0xc0,0x1e,0x00,0x0f,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x03,0x80,0x3c,0x00,0x1e,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x07,0x00,0x78,0x00,0x3c,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x0e,0x00,0xf0,0x00,0x78,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x1c,0x1f,0xe0,0x00,0xf0,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x38,0x1f,0xf0,0x01,0xe0,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x70,0x07,0xdc,0x03,0xe0,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0xe0,0x0f,0x80,0x07,0xc0,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x01,0xc0,0x1f,0x00,0x0f,0x80,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x03,0x80,0x3e,0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x07,0x00,0x7c,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x0e,0x00,0xf8,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x1c,0x3f,0xf0,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x38,0x0f,0xf8,0x01,0xf0,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x70,0x07,0xce,0x03,0xe0,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x70,0x0f,0x80,0x07,0xc0,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0xf0,0x1f,0x00,0x0f,0x80,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0xe0,0x3e,0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0xe0,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x01,0xe0,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0xe0,0x00,0x01,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0xe0,0x00,0x07,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0xe0,0x00,0x0f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x01,0xe0,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x01,0xc0,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x03,0x80,0x03,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x07,0x00,0x1f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x0e,0x00,0x7f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x1c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x3c,0x7f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x78,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x71,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0xe3,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x01,0xc7,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x03,0x8f,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x07,0x8f,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x07,0x1f,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x0e,0x3f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x1c,0x7f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x38,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x38,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x31,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x3b,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x3f,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x3f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x3f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x0f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f
};

 void setup(void)
 {
   tft.begin();
   pinMode(6, OUTPUT);
 }
 void loop()
 {
   sensors.requestTemperatures();


    tft.fillScreen(ILI9340_BLACK);
     tft.setTextSize(5); 
      tft.setTextColor(ILI9340_YELLOW);  
       tft.setCursor(0, 120);
        tft.print("  ");
         tft.print(sensors.getTempCByIndex(0));
          tft.drawBitmap(0,200,myBit1,100,100,  ILI9340_GREEN); 
    
  
 if(sensors.getTempCByIndex(0)>26)
{
  tft.drawBitmap(30,10,myBit2,100,100,  ILI9340_RED);  
  
  tone(6,1000 ,1000);
   tft.setTextSize(2); 
    tft.setTextColor(ILI9340_RED);
     tft.setCursor(90, 170);
      tft.print("UWAGA!");
       tft.setCursor(0, 190);
        tft.print("  WODA ZBYT CIEPLA!");
 }
  else
 {
  tft.drawBitmap(30,10,myBit2,100,100,  ILI9340_GREEN);
}
 if(sensors.getTempCByIndex(0)<25)
{
  tft.drawBitmap(30,10,myBit2,100,100,  ILI9340_BLUE);
   tone(6,1000 ,1000);
    
   tft.setTextSize(2); 
    tft.setTextColor(ILI9340_RED);
     tft.setCursor(90, 170);
      tft.print("UWAGA!");
       tft.setCursor(0, 190);
        tft.print("  WODA ZBYT ZIMNA!");
}        
 delay(1000);
 }
 
 






Miłej zabawy jeśli macie jakieś pytania- wasyl2007233@gmail.com



6 komentarzy:

  1. What is the software to convert image in file.c?

    OdpowiedzUsuń
    Odpowiedzi
    1. http://en.radzio.dxp.pl/bitmap_converter/

      Usuń
    2. Color image
      http://www.digole.com/tools/PicturetoC_Hex_converter.php

      Usuń
  2. http://en.radzio.dxp.pl/bitmap_converter/

    OdpowiedzUsuń
    Odpowiedzi
    1. Color image
      http://www.digole.com/tools/PicturetoC_Hex_converter.php

      Usuń