Ejemplo n.º 1
0
    if(decimal>0)
    {
        drawChar('.',poX, poY, size, fgcolor);
        if(poX < MAX_X)
        {
            poX += FONT_SPACE*size;                                     /* Move cursor right            */
        }
        f +=1;
    }
    decy = floatNumber-temp;                                            /* decimal part,                */
    for(INT8U i=0;i<decimal;i++)
    {
        decy *=10;                                                      /* for the next decimal         */
        temp = decy;                                                    /* get the decimal              */
        drawNumber(temp,poX, poY, size, fgcolor);
        floatNumber = -floatNumber;
        if(poX < MAX_X)
        {
            poX += FONT_SPACE*size;                                     /* Move cursor right            */
        }
        decy -= temp;
    }
    f += decimal;
    return f;
}

TFT Tft=TFT();
/*********************************************************************************************************
  END FILE
*********************************************************************************************************/
Ejemplo n.º 2
0
#include <DHT.h>

// Define cs, dc and reset pins for using the THT screen module
#define cs   10
#define dc   9
#define rst  8

// Define DHT for using DHT module
#define DHTPIN 5
#define DHTTYPE DHT11

// Define RTC for using RTC module
RTC_DS1307 rtc;

// Init screen
TFT tft = TFT(cs, dc, rst);

// Define the days and months
char daysOfTheWeek[7][12] =
{"Sunday", "Monday", "Tuesday", "Wednesday",
 "Thursday", "Friday", "Saturday"};
char monthsOfTheYear[12][12] =
{"January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"};

// SCREEN SETTINGS
int defaultBackground = 0x0000;
int lastAlarmXPos = -1;

// DHT SETTINGS
DHT dht(DHTPIN, DHTTYPE);
Ejemplo n.º 3
0
#include "PadConfiguration.h"

#define lcd_cs 10
#define dc     9
#define rst    8

#include <SPI.h>
#include <TFT.h>

TFT TFTscreen = TFT(lcd_cs, dc, rst);
bool TFTInit = false;

String readLine(File& file)
{
  String res;

  while(file.available())
  {
    char current = (char)file.read();
    if(current == '\n')
    {
      return res;
    }

    res += current;
  }

  return res;
}

PadConfiguration::PadConfiguration(const char* fileName):
Ejemplo n.º 4
0
#include "board.h"
#include "direction.h"

// Pin definition for the Uno
#define cs   10
#define dc   9
#define rst  8

// Strings
#define score_str "Score"
#define high_str "High"
#define uwin_str "GAMEOVER"
#define newHighscore "New highscore!"
#define pressagain_str "Press joystick to restart"

TFT TFTscreen = TFT(cs, dc, rst);

// RGB
uint8_t rgbColour[3];
// RGB to increment and RGB to decrease
uint8_t incColour, decColour;

void Board::init(){
  // Start screen
  TFTscreen.begin();
  // make the background black
  TFTscreen.background(0, 0, 0);

  // Set starting colors
  rgbColour[0] = 255;
  rgbColour[1] = 0;