온도계 시간설정바 히터 예약 버튼 동작 테스트

by 이희철 | 2016-07-11 21:05
sous vide 수비드 수비드머신

설정온도 현재온도와 함께 시간설정과 온도를 그래프로 나타날 수 있도록 프로그램 했다...


한눈에 직관적으로 알아보기 쉽도록 화면디자인에 온도와 남은시간을 그래픽으로 표시하도록 했으며 가열할 때는 히터에 예약중일때는 예약에 LED처럼 불이 들어오도록 했으며 이 역시 상대적으로 비트맵보다 속도가 빠른 그래픽명령 (사각형, 원)을 사용...


숫자 폰트 만드는 것에 비하면 너무 쉽다...


폰트가지고 한번 빡시게 고생했더니...


이런 건 일도 아니란 사실...


순식간에 완성...


참... 쉽..지..요...잉~~~


소스코드는 첨부화일에...





#include <Adafruit_GFX.h>      // Core graphics library

#include <Adafruit_TFTLCD.h> // Hardware-specific library

#include <SD.h>

#include <SPI.h>

#include <EasyTransfer.h>



void seven_seg_set_temp_high_byte(byte HighByte, int COLOR);

void seven_seg_set_temp_low_byte(byte HighByte, int COLOR);


void seven_seg_now_temp_high_byte(byte HighByte, int COLOR);

void seven_seg_now_temp_low_byte(byte HighByte, int COLOR);



//create object

EasyTransfer ET;


struct RECEIVE_DATA_STRUCTURE {

  //put your variable definitions here for the data you want to receive

  //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO

  int button;

  int current_temp;

  int set_temp;

};


//give a name to the group of data

RECEIVE_DATA_STRUCTURE mydata;

// The control pins for the LCD can be assigned to any digital or

// analog pins...but we'll use the analog pins as this allows us to

// double up the pins with the touch screen (see the TFT paint example).

#define LCD_CS A3 // Chip Select goes to Analog 3

#define LCD_CD A2 // Command/Data goes to Analog 2

#define LCD_WR A1 // LCD Write goes to Analog 1

#define LCD_RD A0 // LCD Read goes to Analog 0


// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:

// For the Arduino Uno, Duemilanove, Diecimila, etc.:

//   D0 connects to digital pin 8  (Notice these are

//   D1 connects to digital pin 9   NOT in order!)

//   D2 connects to digital pin 2

//   D3 connects to digital pin 3

//   D4 connects to digital pin 4

//   D5 connects to digital pin 5

//   D6 connects to digital pin 6

//   D7 connects to digital pin 7

// For the Arduino Mega, use digital pins 22 through 29

// (on the 2-row header at the end of the board).


// For Arduino Uno/Duemilanove, etc

//  connect the SD card with DI going to pin 11, DO going to pin 12 and SCK going to pin 13 (stan


//  Then pin 10 goes to CS (or whatever you have set up)

#define SD_CS 10     // Set the chip select line to whatever you use (10 doesnt conflict with the library)\

  // In the SD card, place 24 bit color BMP files (be sure they are 24-bit!)

// There are examples in the sketch folder


// our TFT wiring

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, A4);

uint8_t         spi_save;


#define BLACK   0x0000

#define BLUE    0x001F

#define RED     0xF800

#define GREEN   0x07E0

#define CYAN    0x08EF

#define MAGENTA 0xF5E0

#define YELLOW  0xFFE0

#define WHITE   0xFFFF

#define MYDEFINE 0x79F


int COLOR;


int local_current_temp = 0;

int local_set_temp = 0;


int Diff_c_y = 30;  // Difference y is 30 pixel for segment c

int Diff_d_y = 60;  // Difference y is 60 pixel for segment d

int Diff_c_y_low = 10; // 현재온도 하위표시자리를 위한 세로축  y축 이동...

int Diff_d_y_low = 20;  // 현재온도 하위표시자리를 한 가로선 y축 동...


int MoveX_low = 19;  // Move to 18 pixel to right for 현재온도하위비트 

int MoveX = 46;  // Move to 46 pixel to right


  // Define the TFT LCD digit segments from 0 - 9

byte seven_seg_digits[10][7] = { { 1,1,1,1,1,1,0 },  // = 0

                                 { 0,1,1,0,0,0,0 },  // = 1

                                 { 1,1,0,1,1,0,1 },  // = 2

                                 { 1,1,1,1,0,0,1 },  // = 3

                                 { 0,1,1,0,0,1,1 },  // = 4

                                 { 1,0,1,1,0,1,1 },  // = 5

                                 { 1,0,1,1,1,1,1 },  // = 6

                                 { 1,1,1,0,0,0,0 },  // = 7

                                 { 1,1,1,1,1,1,1 },  // = 8

                                 { 1,1,1,1,0,1,1 }   // = 9

                               };



void setup()

{

  Serial.begin(9600);

  //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.

  ET.begin(details(mydata), &Serial);


  tft.reset();


  uint16_t identifier = tft.readID();


  tft.begin(identifier);


  Serial.print(F("Initializing SD card..."));

  if (!SD.begin(SD_CS)) {

    Serial.println(F("failed!"));

    return;

  }

  

  Serial.println(F("OK!"));

  spi_save = SPCR;


  tft.setRotation(1);

   bmpDraw("default.bmp", 0, 0);//배경 이미지

 //    bmpDraw("fulldisp.bmp", 0, 0);//배경 이미지


  //tft_settemp(0);

  //tft_currtemp(0);

 // tft_timebar(0);

}


  

void loop()

{



   int toggle =0; 

   int ti_bar=10; 

   int temp_bar = 20;

  my_cleaner_hour();

   

 while(1) {

   toggle = toggle %2;

   

  if (toggle) {

   tft.fillCircle(137, 37, 4, RED); // 히터 on  

   tft.fillCircle(182, 37, 4, RED); // 약 on  

   

   if (ti_bar < 1) {   ti_bar=10;   }

      tft_timebar(ti_bar); //시간 바

     ti_bar--;

     

     if (temp_bar > 110) { temp_bar = 20;}

     tft_tempbar(temp_bar);

     temp_bar += 10;

  } else

  {

       tft.fillCircle(137, 37, 4, WHITE); // 히터 OFF  

       tft.fillCircle(182, 37, 4, WHITE); // 예약 OFF  

  }// else if

  

     toggle++;

     delay(500);

 } // end of while


/*

// ---------------------------------------------- 

    if (mydata.button == HIGH) {

      tft.fillCircle(137, 37, 4, RED);  // 히터 ON


    }

    else {


      tft.fillCircle(137, 37, 4, WHITE);  // 히터 OFF

    }

  //you should make this delay shorter then your transmit delay or else messages could be lost

  delay(250);

*/


} // end of loop


// This function opens a Windows Bitmap (BMP) file and

// displays it at the given coordinates.  It's sped up

// by reading many pixels worth of data at a time

// (rather than pixel by pixel).  Increasing the buffer

// size takes more of the Arduino's precious RAM but

// makes loading a little faster.  20 pixels seems a

// good balance.


#define BUFFPIXEL 20


void bmpDraw(char *filename, int x, int y) {

  File     bmpFile;

  int      bmpWidth, bmpHeight;   // W+H in pixels

  uint8_t  bmpDepth;              // Bit depth (currently must be 24)

  uint32_t bmpImageoffset;        // Start of image data in file

  uint32_t rowSize;               // Not always = bmpWidth; may have padding

  uint8_t  sdbuffer[3 * BUFFPIXEL]; // pixel in buffer (R+G+B per pixel)

  uint16_t lcdbuffer[BUFFPIXEL];  // pixel out buffer (16-bit per pixel)

  uint8_t  buffidx = sizeof(sdbuffer); // Current position in sdbuffer

  boolean  goodBmp = false;       // Set to true on valid header parse

  boolean  flip    = true;        // BMP is stored bottom-to-top

  int      w, h, row, col;

  uint8_t  r, g, b;

  uint32_t pos = 0, startTime = millis();

  uint8_t  lcdidx = 0;

  boolean  first = true;


  if ((x >= tft.width()) || (y >= tft.height())) return;


  Serial.println();

  Serial.print("Loading image '");

  Serial.print(filename);

  Serial.println('\'');

  // Open requested file on SD card

  SPCR = spi_save;

  if ((bmpFile = SD.open(filename)) == NULL) {

    Serial.print("File not found");

    return;

  }


  // Parse BMP header

  if (read16(bmpFile) == 0x4D42) { // BMP signature

    Serial.print(F("File size: ")); Serial.println(read32(bmpFile));

    (void)read32(bmpFile); // Read & ignore creator bytes

    bmpImageoffset = read32(bmpFile); // Start of image data

    Serial.print(F("Image Offset: ")); Serial.println(bmpImageoffset, DEC);

    // Read DIB header

    Serial.print(F("Header size: ")); Serial.println(read32(bmpFile));

    bmpWidth  = read32(bmpFile);

    bmpHeight = read32(bmpFile);

    if (read16(bmpFile) == 1) { // # planes -- must be '1'

      bmpDepth = read16(bmpFile); // bits per pixel

      Serial.print(F("Bit Depth: ")); Serial.println(bmpDepth);

      if ((bmpDepth == 24) && (read32(bmpFile) == 0)) { // 0 = uncompressed


        goodBmp = true; // Supported BMP format -- proceed!

        Serial.print(F("Image size: "));

        Serial.print(bmpWidth);

        Serial.print('x');

        Serial.println(bmpHeight);


        // BMP rows are padded (if needed) to 4-byte boundary

        rowSize = (bmpWidth * 3 + 3) & ~3;


        // If bmpHeight is negative, image is in top-down order.

        // This is not canon but has been observed in the wild.

        if (bmpHeight < 0) {

          bmpHeight = -bmpHeight;

          flip      = false;

        }


        // Crop area to be loaded

        w = bmpWidth;

        h = bmpHeight;

        if ((x + w - 1) >= tft.width())  w = tft.width()  - x;

        if ((y + h - 1) >= tft.height()) h = tft.height() - y;


        // Set TFT address window to clipped image bounds

        SPCR = 0;

        tft.setAddrWindow(x, y, x + w - 1, y + h - 1);


        for (row = 0; row < h; row++) { // For each scanline...

          // Seek to start of scan line.  It might seem labor-

          // intensive to be doing this on every line, but this

          // method covers a lot of gritty details like cropping

          // and scanline padding.  Also, the seek only takes

          // place if the file position actually needs to change

          // (avoids a lot of cluster math in SD library).

          if (flip) // Bitmap is stored bottom-to-top order (normal BMP)

            pos = bmpImageoffset + (bmpHeight - 1 - row) * rowSize;

          else     // Bitmap is stored top-to-bottom

            pos = bmpImageoffset + row * rowSize;

          SPCR = spi_save;

          if (bmpFile.position() != pos) { // Need seek?

            bmpFile.seek(pos);

            buffidx = sizeof(sdbuffer); // Force buffer reload

          }


          for (col = 0; col < w; col++) { // For each column...

            // Time to read more pixel data?

            if (buffidx >= sizeof(sdbuffer)) { // Indeed

              // Push LCD buffer to the display first

              if (lcdidx > 0) {

                SPCR   = 0;

                tft.pushColors(lcdbuffer, lcdidx, first);

                lcdidx = 0;

                first  = false;

              }

              SPCR = spi_save;

              bmpFile.read(sdbuffer, sizeof(sdbuffer));

              buffidx = 0; // Set index to beginning

            }


            // Convert pixel from BMP to TFT format

            b = sdbuffer[buffidx++];

            g = sdbuffer[buffidx++];

            r = sdbuffer[buffidx++];

            lcdbuffer[lcdidx++] = tft.color565(r, g, b);

          } // end pixel

        } // end scanline

        // Write any remaining data to LCD

        if (lcdidx > 0) {

          SPCR = 0;

          tft.pushColors(lcdbuffer, lcdidx, first);

        }

        Serial.print(F("Loaded in "));

        Serial.print(millis() - startTime);

        Serial.println(" ms");

      } // end goodBmp

    }

  }


  bmpFile.close();

  if (!goodBmp) Serial.println("BMP format not recognized.");

}


// These read 16- and 32-bit types from the SD card file.

// BMP data is stored little-endian, Arduino is little-endian too.

// May need to reverse subscript order if porting elsewhere.


uint16_t read16(File f) {

  uint16_t result;

  ((uint8_t *)&result)[0] = f.read(); // LSB

  ((uint8_t *)&result)[1] = f.read(); // MSB

  return result;

}


uint32_t read32(File f) {

  uint32_t result;

  ((uint8_t *)&result)[0] = f.read(); // LSB

  ((uint8_t *)&result)[1] = f.read();

  ((uint8_t *)&result)[2] = f.read();

  ((uint8_t *)&result)[3] = f.read(); // MSB

  return result;

}



/* 디스플레이 영역 */



void my_cleaner_hour() {

  

  tft.drawRect (37,39,15,139,RED);

  tft.fillRect(39, 165, 12, 11, WHITE);

  tft.fillRect(39, 151, 12, 11, WHITE);

  tft.fillRect(39, 137, 12, 11, WHITE);

  tft.fillRect(39, 124, 12, 11, WHITE);

  tft.fillRect(39, 110, 12, 11, WHITE);

  tft.fillRect(39, 96, 12, 11, WHITE);

  tft.fillRect(39, 83, 12, 11, WHITE);

  tft.fillRect(39, 69, 12, 11, WHITE);

  tft.fillRect(39, 55, 12, 11, WHITE);

  tft.fillRect(39, 41, 12, 11, WHITE);


}

void my_cleaner_temp() {


  tft.fillRect(273, 159, 5, 20, WHITE);

  tft.fillRect(273, 145, 5, 12, WHITE);

  tft.fillRect(273, 131, 5, 12, WHITE);

  tft.fillRect(273, 117, 5, 12, WHITE);

  tft.fillRect(273, 103, 5, 12, WHITE);

  tft.fillRect(273, 89, 5, 12, WHITE);

  tft.fillRect(273, 75, 5, 12, WHITE);

  tft.fillRect(273, 61, 5, 12, WHITE);

  tft.fillCircle(275, 48, 2, WHITE);

  tft.fillRect(273, 50, 5, 9, WHITE);

  tft.fillCircle(275, 182, 7, RED);


}


void tft_timebar(int hourtime) {

 // my_cleaner_hour();


  switch (hourtime) {


    case 1:

      my_cleaner_hour();

      tft.fillRect(39, 165, 12, 11, GREEN);

      break;


    case 2:

      my_cleaner_hour();

      tft.fillRect(39, 165, 12, 11, GREEN);

      tft.fillRect(39, 151, 12, 11, GREEN);

      break;


    case 3:

      my_cleaner_hour();

      tft.fillRect(39, 165, 12, 11, GREEN);

      tft.fillRect(39, 151, 12, 11, GREEN);

      tft.fillRect(39, 137, 12, 11, GREEN);

      break;


    case 4:

      my_cleaner_hour();

      tft.fillRect(39, 165, 12, 11, GREEN);

      tft.fillRect(39, 151, 12, 11, GREEN);

      tft.fillRect(39, 137, 12, 11, GREEN);

      tft.fillRect(39, 124, 12, 11, GREEN);

      break;


    case 5:

      my_cleaner_hour();

      tft.fillRect(39, 165, 12, 11, GREEN);

      tft.fillRect(39, 151, 12, 11, GREEN);

      tft.fillRect(39, 137, 12, 11, GREEN);

      tft.fillRect(39, 124, 12, 11, GREEN);

      tft.fillRect(39, 110, 12, 11, GREEN);

      break;


    case 6:

      my_cleaner_hour();

      tft.fillRect(39, 165, 12, 11, GREEN);

      tft.fillRect(39, 151, 12, 11, GREEN);

      tft.fillRect(39, 137, 12, 11, GREEN);

      tft.fillRect(39, 124, 12, 11, GREEN);

      tft.fillRect(39, 110, 12, 11, GREEN);

      tft.fillRect(39, 96, 12, 11, GREEN);

      break;


    case 7:

      my_cleaner_hour();

      tft.fillRect(39, 165, 12, 11, GREEN);

      tft.fillRect(39, 151, 12, 11, GREEN);

      tft.fillRect(39, 137, 12, 11, GREEN);

      tft.fillRect(39, 124, 12, 11, GREEN);

      tft.fillRect(39, 110, 12, 11, GREEN);

      tft.fillRect(39, 96, 12, 11, GREEN);

      tft.fillRect(39, 83, 12, 11, GREEN);

      break;


    case 8:

      my_cleaner_hour();

      tft.fillRect(39, 165, 12, 11, GREEN);

      tft.fillRect(39, 151, 12, 11, GREEN);

      tft.fillRect(39, 137, 12, 11, GREEN);

      tft.fillRect(39, 124, 12, 11, GREEN);

      tft.fillRect(39, 110, 12, 11, GREEN);

      tft.fillRect(39, 96, 12, 11, GREEN);

      tft.fillRect(39, 83, 12, 11, GREEN);

      tft.fillRect(39, 69, 12, 11, GREEN);

      break;

    case 9:

      my_cleaner_hour();

      tft.fillRect(39, 165, 12, 11, GREEN);

      tft.fillRect(39, 151, 12, 11, GREEN);

      tft.fillRect(39, 137, 12, 11, GREEN);

      tft.fillRect(39, 124, 12, 11, GREEN);

      tft.fillRect(39, 110, 12, 11, GREEN);

      tft.fillRect(39, 96, 12, 11, GREEN);

      tft.fillRect(39, 83, 12, 11, GREEN);

      tft.fillRect(39, 69, 12, 11, GREEN);

      tft.fillRect(39, 55, 12, 11, GREEN);

      break;


    case 10:

      my_cleaner_hour();

      tft.fillRect(39, 165, 12, 11, GREEN);

      tft.fillRect(39, 151, 12, 11, GREEN);

      tft.fillRect(39, 137, 12, 11, GREEN);

      tft.fillRect(39, 124, 12, 11, GREEN);

      tft.fillRect(39, 110, 12, 11, GREEN);

      tft.fillRect(39, 96, 12, 11, GREEN);

      tft.fillRect(39, 83, 12, 11, GREEN);

      tft.fillRect(39, 69, 12, 11, GREEN);

      tft.fillRect(39, 55, 12, 11, GREEN);

      tft.fillRect(39, 41, 12, 11, GREEN);

      break;


    default:

      my_cleaner_hour();

      break;

  }


}

void tft_tempbar(int c) {


  tft.fillCircle(275, 182, 7, RED);


  int range = map(c, 20, 100, 1, 9);

  my_cleaner_temp();

  switch (range) {

    case 1:

      my_cleaner_temp();

      tft.fillRect(273, 159, 5, 20, RED);

      break;

    case 2:

      my_cleaner_temp();

      tft.fillRect(273, 159, 5, 20, RED);

      tft.fillRect(273, 145, 5, 12, RED);

      break;

    case 3:

      my_cleaner_temp();

      tft.fillRect(273, 159, 5, 20, RED);

      tft.fillRect(273, 145, 5, 12, RED);

      tft.fillRect(273, 131, 5, 12, RED);

      break;

    case 4:

      my_cleaner_temp();

      tft.fillRect(273, 159, 5, 20, RED);

      tft.fillRect(273, 145, 5, 12, RED);

      tft.fillRect(273, 131, 5, 12, RED);

      tft.fillRect(273, 117, 5, 12, RED);

      break;

    case 5:

      my_cleaner_temp();

      tft.fillRect(273, 159, 5, 20, RED);

      tft.fillRect(273, 145, 5, 12, RED);

      tft.fillRect(273, 131, 5, 12, RED);

      tft.fillRect(273, 117, 5, 12, RED);

      tft.fillRect(273, 103, 5, 12, RED);

      break;

    case 6:

      my_cleaner_temp();

      tft.fillRect(273, 159, 5, 20, RED);

      tft.fillRect(273, 145, 5, 12, RED);

      tft.fillRect(273, 131, 5, 12, RED);

      tft.fillRect(273, 117, 5, 12, RED);

      tft.fillRect(273, 103, 5, 12, RED);

      tft.fillRect(273, 89, 5, 12, RED);

      break;

    case 7:

      my_cleaner_temp();

      tft.fillRect(273, 159, 5, 20, RED);

      tft.fillRect(273, 145, 5, 12, RED);

      tft.fillRect(273, 131, 5, 12, RED);

      tft.fillRect(273, 117, 5, 12, RED);

      tft.fillRect(273, 103, 5, 12, RED);

      tft.fillRect(273, 89, 5, 12, RED);

      tft.fillRect(273, 75, 5, 12, RED);

      break;

    case 8:

      my_cleaner_temp();

      tft.fillRect(273, 159, 5, 20, RED);

      tft.fillRect(273, 145, 5, 12, RED);

      tft.fillRect(273, 131, 5, 12, RED);

      tft.fillRect(273, 117, 5, 12, RED);

      tft.fillRect(273, 103, 5, 12, RED);

      tft.fillRect(273, 89, 5, 12, RED);

      tft.fillRect(273, 75, 5, 12, RED);

      tft.fillRect(273, 61, 5, 12, RED);

      break;

    case 9:

      my_cleaner_temp();

      tft.fillRect(273, 159, 5, 20, RED);

      tft.fillRect(273, 145, 5, 12, RED);

      tft.fillRect(273, 131, 5, 12, RED);

      tft.fillRect(273, 117, 5, 12, RED);

      tft.fillRect(273, 103, 5, 12, RED);

      tft.fillRect(273, 89, 5, 12, RED);

      tft.fillRect(273, 75, 5, 12, RED);

      tft.fillRect(273, 61, 5, 12, RED);

      tft.fillCircle(275, 48, 2, RED);

      tft.fillRect(273, 50, 5, 9, RED);

      break;

  }


}



void tft_settemp(int b) {

  tft.fillRect(92, 112, 85, 65, BLACK);

  tft.setCursor(92, 112);

  tft.setTextColor(MAGENTA);

  tft.setTextSize(7);

  tft.println(b);

}


void tft_currtemp(int a) {


  tft.fillRect(210, 147, 40, 35, BLACK);

  tft.setCursor(210, 147);

  tft.setTextColor(RED);

  tft.setTextSize(3);

  tft.println(a);


  tft_tempbar(a);


}




//  설정온도 상위바이트 표시 

void seven_seg_set_temp_high_byte(byte HighByte, int COLOR) {


  

   byte segCount = 0;                            

                               

  //  for (byte segCount = 0; segCount < 7; ++segCount) {

         set_high_byte_segment_a (seven_seg_digits[HighByte][segCount], COLOR);

         segCount++;

         set_high_byte_segment_b (seven_seg_digits[HighByte][segCount], COLOR);   

         segCount++; 

         set_high_byte_segment_c (seven_seg_digits[HighByte][segCount], COLOR); 

         segCount++; 

         set_high_byte_segment_d (seven_seg_digits[HighByte][segCount], COLOR);

         segCount++; 

         set_high_byte_segment_e (seven_seg_digits[HighByte][segCount], COLOR);  

         segCount++; 

         set_high_byte_segment_f (seven_seg_digits[HighByte][segCount], COLOR);  

         segCount++; 

         set_high_byte_segment_g (seven_seg_digits[HighByte][segCount], COLOR);        

 //   } // for

} // end of function

 

//  설정온도 하위바이트 표시 

void seven_seg_set_temp_low_byte(byte HighByte, int COLOR) {


   byte segCount = 0;                            

                               

  //  for (byte segCount = 0; segCount < 7; ++segCount) {

         set_low_byte_segment_a (seven_seg_digits[HighByte][segCount], COLOR);

         segCount++;

         set_low_byte_segment_b (seven_seg_digits[HighByte][segCount], COLOR);   

         segCount++; 

         set_low_byte_segment_c (seven_seg_digits[HighByte][segCount], COLOR); 

         segCount++; 

         set_low_byte_segment_d (seven_seg_digits[HighByte][segCount], COLOR);

         segCount++; 

         set_low_byte_segment_e (seven_seg_digits[HighByte][segCount], COLOR);  

         segCount++; 

         set_low_byte_segment_f (seven_seg_digits[HighByte][segCount], COLOR);  

         segCount++; 

         set_low_byte_segment_g (seven_seg_digits[HighByte][segCount], COLOR);        

 //   } // for

} // end of function

 

 

 

//  현재온도 상위바이트 표시 

 void seven_seg_now_temp_high_byte(byte HighByte, int COLOR) {


   byte segCount = 0;                            

                               

  //  for (byte segCount = 0; segCount < 7; ++segCount) {

         time_high_byte_segment_a (seven_seg_digits[HighByte][segCount], COLOR);

         segCount++;

         time_high_byte_segment_b (seven_seg_digits[HighByte][segCount], COLOR);   

         segCount++; 

         time_high_byte_segment_c (seven_seg_digits[HighByte][segCount], COLOR); 

         segCount++; 

         time_high_byte_segment_d (seven_seg_digits[HighByte][segCount], COLOR);

         segCount++; 

         time_high_byte_segment_e (seven_seg_digits[HighByte][segCount], COLOR);  

         segCount++; 

         time_high_byte_segment_f (seven_seg_digits[HighByte][segCount], COLOR);  

         segCount++; 

         time_high_byte_segment_g (seven_seg_digits[HighByte][segCount], COLOR);        

 //   } // for

} // end of function


//////////////////////////////////////////////

//  현재온도 하위바이트 표시 

/////////////////////////////////////////////

 void seven_seg_now_temp_low_byte(byte HighByte, int COLOR) {


  

   byte segCount = 0;                            

                               

  //  for (byte segCount = 0; segCount < 7; ++segCount) {

         time_low_byte_segment_a (seven_seg_digits[HighByte][segCount], COLOR);

         segCount++;

         time_low_byte_segment_b (seven_seg_digits[HighByte][segCount], COLOR);   

         segCount++; 

         time_low_byte_segment_c (seven_seg_digits[HighByte][segCount], COLOR); 

         segCount++; 

         time_low_byte_segment_d (seven_seg_digits[HighByte][segCount], COLOR);

         segCount++; 

         time_low_byte_segment_e (seven_seg_digits[HighByte][segCount], COLOR);  

         segCount++; 

         time_low_byte_segment_f (seven_seg_digits[HighByte][segCount], COLOR);  

         segCount++; 

         time_low_byte_segment_g (seven_seg_digits[HighByte][segCount], COLOR);        

 //   } // for

} // end of function








 

// -------------------------------------------------

// 설정 온도상위  7 segment a

 void set_high_byte_segment_a (boolean disp,int COLOR)

  {

   if (disp) {  

    for (int i=0;i < 8 ; i++) {

        tft.drawLine(92+i,110+i,128-i,110+i,COLOR); 

      } // for

  } // if

 } // end of function

  

// -------------------------------------------------



  // 설정 온도상위  7 segment b

 void set_high_byte_segment_b (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 4 ; i++) {

        tft.drawLine(128-i,113+i,128-i,140-i,COLOR); 

      } // for 

      

      for (int i=0;i < 6 ; i++) {

        tft.drawLine(126-i,115+i,126-i,141-i,COLOR); 

      } // for      

    } // if

   

} // end of function



 // -------------------------------------------------

  // 설정 온도상위  7 segment c

 void set_high_byte_segment_c (boolean disp, int COLOR)

 {

    if (disp) {

        for (int i=0;i < 8 ; i++) {

        tft.drawLine(129 -i,111+Diff_c_y + i,129-i,143+Diff_c_y - i,COLOR); 

      } // for

    } // if

} // end of function



// -------------------------------------------------

// 설정 온도상위  7 segment d

void set_high_byte_segment_d (boolean disp, int COLOR)

 {

    if (disp) {

     for (int i=0;i < 8 ; i++) {

  tft.drawLine(98-i,(108 + Diff_d_y + i),119+i,(108 + Diff_d_y + i),COLOR); 

}   

    } // if

} // end of function 


// -------------------------------------------------

  // 설정 온도상위  7 segment e


 void set_high_byte_segment_e (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 8 ; i++) {

        tft.drawLine(90+i,143+i,90+i,173-i,COLOR); 

      } // for

    } // if

} // end of function


// -------------------------------------------------

  // 설정 온도상위  7 segment f

 void set_high_byte_segment_f (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 4 ; i++) {

        tft.drawLine(90 +i,111+i,90+i,140+i,COLOR); 

      }//for  

      

      for (int i=0;i < 4 ; i++) {

        tft.drawLine(94+i,115+i,94+i,141-i,COLOR); 

      }  // for

    } // if

} // end of function



// -------------------------------------------------

  // 설정 온도상위  7 segment g


 void set_high_byte_segment_g (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 4 ; i++) {

        tft.drawLine(98-i,140+i,121+i,140+i,COLOR); 

      } //for

      for (int i=0;i < 4 ; i++) {

        tft.drawLine(94+i,144+i,124-i,144+i,COLOR); 

      } //for   

    } // if

} // end of function


// ============================================================

//   설정온도하위비트

//=============================================================

// -------------------------------------------------

  // 설정 온도 하위  7 segment a



 void set_low_byte_segment_a (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 8 ; i++) {

        tft.drawLine(92+MoveX+i,110+i,128+MoveX-i,110+i,COLOR); 

      } // for   

     } // if

} // end of function


// -------------------------------------------------

  // 설정 온도 하위  7 segment b

 void set_low_byte_segment_b (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 4 ; i++) {

        tft.drawLine(129+MoveX-i,111+i,129+MoveX-i,139+i,COLOR); 

      } //for


      for (int i=0;i < 6 ; i++) {

        tft.drawLine(126+MoveX-i,115+i,126+MoveX-i,141-i,COLOR); 

      }  //for  

    } // if

} // end of function


// -------------------------------------------------

  // 설정 온도하위  7 segment c

 void set_low_byte_segment_c (boolean disp, int COLOR)

 {

    if (disp) {

       for (int i=0;i < 8 ; i++) {

        tft.drawLine(129+MoveX-i,111+Diff_c_y + i,129+MoveX-i,145+Diff_c_y - i,COLOR); 

       }  // for 

    } // if

} // end of function


// -------------------------------------------------

  // 설정 온도하위  7 segment d

 void set_low_byte_segment_d (boolean disp, int COLOR)

 {

    if (disp) {

       for (int i=0;i < 8 ; i++) {

        tft.drawLine(98+MoveX-i,(108 + Diff_d_y + i),119+MoveX+i,(108 + Diff_d_y + i),COLOR); 

      } // for

    } // if

} // end of function


// -------------------------------------------------

  // 설정 온도하위  7 segment e

 void set_low_byte_segment_e (boolean disp, int COLOR)

 {

    if (disp) {

       for (int i=0;i < 8 ; i++) {

        tft.drawLine(90+MoveX+i,143+i,90+MoveX+i,173-i,COLOR); 

       } // for

    } // if

} // end of function


// -------------------------------------------------

  // 설정 온도하위  7 segment f

 void set_low_byte_segment_f (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 4 ; i++) {

        tft.drawLine(90+MoveX+i,111+i,90+MoveX+i,140+i,COLOR); 

      }  // for 

      for (int i=0;i < 4 ; i++) {

        tft.drawLine(94+MoveX+i,115+i,94+MoveX+i,141-i,COLOR); 

      }   // for      

    } // if

} // end of function


// -------------------------------------------------

  // 설정 온도하위  7 segment g



 void set_low_byte_segment_g (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 4 ; i++) {

        tft.drawLine(98+MoveX-i,140+i,121+MoveX+i,140+i,COLOR); 

      } // for

      for (int i=0;i < 4 ; i++) {

        tft.drawLine(94+MoveX+i,144+i,124+MoveX-i,144+i,COLOR); 

      } // for

    } // if

} // end of function


// ============================================================

//   현재 온도상위비트

//=============================================================


// -------------------------------------------------

  //  현재 온도상위  7 segment a

 void time_high_byte_segment_a (boolean disp, int COLOR)

 {

    if (disp) {

     for (int i=0;i < 3 ; i++) {

      tft.drawLine(210+i,149+i,224-i,149+i,COLOR); 

    }  // for

    } // if

} // end of function


// -------------------------------------------------

  //  현재 온도상위  7 segment b


 void time_high_byte_segment_b (boolean disp, int COLOR)

 {

    if (disp) {

       for (int i=0;i < 2 ; i++) {

        tft.drawLine(225 -i,150+i,225-i,160+i,COLOR); 

       } // for


      for (int i=0;i < 2 ; i++) {

        tft.drawLine(223-i,152+i,223-i,161-i,COLOR); 

      }  // for

    } // if

} // end of function


// -------------------------------------------------

  // 현재  온도상위  7 segment c


 void time_high_byte_segment_c (boolean disp, int COLOR)

 {

    if (disp) {

        for (int i=0;i < 4 ; i++) {

        tft.drawLine(225 -i,151+Diff_c_y_low+i,225-i,164+Diff_c_y_low - i,COLOR); 

      }  // for

    } // if

} // end of function


// -------------------------------------------------

  // 현재  온도상위  7 segment d

 void time_high_byte_segment_d (boolean disp, int COLOR)

 {

    if (disp) {

       for (int i=0;i < 3 ; i++) {

        tft.drawLine(212-i,(153 + Diff_d_y_low + i),222+i,(153 + Diff_d_y_low + i),COLOR); 

      }  // for

    } // if

} // end of function


 

// -------------------------------------------------

  // 현재  온도상위  7 segment e


 void time_high_byte_segment_e (boolean disp, int COLOR)

 {

    if (disp) {

       for (int i=0;i < 4 ; i++) {

        tft.drawLine(209+i,162+i,209+i,174-i,COLOR); 

      }  // for

    } // if

} // end of function


// -------------------------------------------------

  // 현재  온도상위  7 segment f

 void time_high_byte_segment_f (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 2 ; i++) {

        tft.drawLine(211+i,152+i,211+i,162-i,COLOR); 

      } // for

      for (int i=0;i < 2 ; i++) {

        tft.drawLine(209 +i,150+i,209+i,160+i,COLOR); 

      } // for

    } // if

} // end of function


// -------------------------------------------------

  // 현재  온도상위  7 segment g


 void time_high_byte_segment_g (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 2 ; i++) {

        tft.drawLine(214-i,160+i,220+i,160+i,COLOR); 

}

      for (int i=0;i < 2 ; i++) {

        tft.drawLine(212+i,162+i,222-i,162+i,COLOR); 

      } // for

   } // if

} // end of function



// ============================================================

//   현재 온도하위 바이트 

//=============================================================


// -------------------------------------------------

  //  현재 온도하위  7 segment a


 void time_low_byte_segment_a (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 3 ; i++) {

        tft.drawLine(210+MoveX_low+i,149+i,224+MoveX_low-i,149+i,COLOR); 

      } // for

    } // if

} // end of function


// -------------------------------------------------

  //  현재 온도하위  7 segment b


 void time_low_byte_segment_b (boolean disp, int COLOR)

 {

    if (disp) {

       for (int i=0;i < 2 ; i++) {

        tft.drawLine(225+MoveX_low-i,150+i,225+MoveX_low-i,160+i,COLOR); 

       }  // for


      for (int i=0;i < 2 ; i++) {

        tft.drawLine(223+MoveX_low-i,152+i,223+MoveX_low-i,161-i,COLOR); 

      } // for

   } // if

} // end of function


// -------------------------------------------------

  // 현재  온도하위  7 segment c


 void time_low_byte_segment_c (boolean disp, int COLOR)

 {

    if (disp) {

       for (int i=0;i < 4 ; i++) {

        tft.drawLine(225+MoveX_low-i,151+Diff_c_y_low+i,225+MoveX_low-i,164+Diff_c_y_low - i,COLOR); 

      } // for

    } // if

} // end of function


// -------------------------------------------------

  // 현재  온도하위  7 segment d

 void time_low_byte_segment_d (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 3 ; i++) {

        tft.drawLine(212+MoveX_low-i,(153 + Diff_d_y_low + i),222+MoveX_low+i,(153 + Diff_d_y_low + i),COLOR); 

      }  // for

    } // if

} // end of function


// -------------------------------------------------

  // 현재  온도하위  7 segment e


 void time_low_byte_segment_e (boolean disp, int COLOR)

 {

    if (disp) {

       for (int i=0;i < 4 ; i++) {

        tft.drawLine(209+MoveX_low+i,162+i,209+MoveX_low+i,174-i,COLOR); 

      } // for

    } // if

} // end of function


// -------------------------------------------------

  // 현재  온도하위  7 segment f


 void time_low_byte_segment_f (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 2 ; i++) {

        tft.drawLine(209+MoveX_low+i,150+i,209+MoveX_low+i,160+i,COLOR); 

      }  // for


      for (int i=0;i < 2 ; i++) {

        tft.drawLine(211+MoveX_low+i,152+i,211+MoveX_low+i,162-i,COLOR); 

      }  // for

    } // if

} // end of function


// -------------------------------------------------

  // 현재  온도하위  7 segment g


 void time_low_byte_segment_g (boolean disp, int COLOR)

 {

    if (disp) {

      for (int i=0;i < 2 ; i++) {

        tft.drawLine(214+MoveX_low-i,160+i,220+MoveX_low+i,160+i,COLOR); 

      } // for

      for (int i=0;i < 2 ; i++) {

        tft.drawLine(212+MoveX_low+i,162+i,222+MoveX_low-i,162+i,COLOR); 

      } // for

    } // if

} // end of function

댓글 0

MADE BY

이희철

요리, 전자회로설계