#include <Adafruit_ST7735.h> // Hardware-specific library #include <SPI.h> #include <SD.h> // standard U of A library settings, assuming Atmel Mega SPI pins #define SD_CS 5 // Chip select line for SD card #define TFT_CS 6 // Chip select line for TFT display #define TFT_DC 7 // Data/command line for TFT #define TFT_RST 8 // Reset line for TFT (or connect to +5V) // Pins of the RGB LED #define redPin 38 #define greenPin 37 #define bluePin 36 Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); #include "Place_Ships.h" #include "Draw_Screen.h" #include "lcd_image.h" #include "Images.h" #include "Shots.h" #include "Cursor.h" #include "Write_Message.h" #include "Victory_Cascade.h" #include "SoundFX.h" // An array to hold all the images that we need. This makes it easier // to use in multiple functions. lcd_image_t Images[10] = { { "Water.lcd", 12, 12 },
// forward function declarations void initialize_sd_card(); void initialize_screen(); void initialize_joystick(); uint8_t process_joystick(int16_t *dx, int16_t *dy); void status_msg(char *msg); void clear_status_msg(); // Interrupt routines for zooming in and out. void handle_zoom_in(); void handle_zoom_out(); // global state variables // globally accessible screen Adafruit_ST7735 tft = Adafruit_ST7735(tft_cs, tft_dc, tft_rst); // Map number (zoom level) currently selected. extern uint8_t current_map_num; // First time flag for loop, set to cause actions for the first time only uint8_t first_time; void setup() { Serial.begin(9600); Serial.println("Starting..."); delay(500); Serial.flush(); // There can be nasty leftover bits. initialize_screen();
////////////////////////////////////////////////////////////////////////////// // Global variables follow ////////////////////////////////////////////////////////////////////////////// int menuState; MiniDuino myMiniDuino; int sensNum; ////////////////////////////////////////////////////////////////////////////// // class initializers ////////////////////////////////////////////////////////////////////////////// Adafruit_ST7735 tft = Adafruit_ST7735(LCD_CS, LCD_DC, LCD_RST); ////////////////////////////////////////////////////////////////////////////// // setup() ////////////////////////////////////////////////////////////////////////////// void setup() { Serial.begin(9600); menuState = TESTKEYPAD_MENU; tft.initR(INITR_REDTAB); tft.setTextSize(1); tft.fillScreen(ST7735_BLACK);
#define cs A2 #define dc D0 #define rst 0 #include "Adafruit_ST7735.h" Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst); // hardware spi void setup() { Serial.begin(9600); tft.initG(); tft.fillScreen(ST7735_BLACK); } void loop() { Serial.println("printing though!"); tft.fillScreen(ST7735_BLACK); // tft.setCursor(0, 0); tft.setTextColor(ST7735_WHITE); tft.setTextWrap(true); // tft.setTextSize(3); // tft.setCursor(30, 3); tft.setFont(HERO_10); tft.drawRightString("OTTAWA", 3);
#include <EEPROM.h> #include <Wire.h> #ifdef hal_raster ILI9325C_Leo Raster; RasterDraw16 Draw(&Raster); #endif #ifdef hal_tft // include libraries #include <Adafruit_GFX.h> // Core graphics library #include <Adafruit_ST7735.h> // Hardware-specific library #include <SPI.h> // instance object Adafruit_ST7735 lcd = Adafruit_ST7735(10, A0, 4); // (cs, dc, rst); #endif #include <unorthodox.h> #ifdef hal_compass HMC5883L compass; #endif #ifdef hal_beeps // use the beeps! DroidBeeps beeps(9); PROGMEM prog_uint16_t vocal_stream[] = { 0x3B15, 0x264B, 0x385D, 0x3291, 0x2832, 0x1AB8, // I am a droid! 0x139A, 0x3DA4, 0x1915, 0x21EB, 0x2822, 0x36D4, // beep boop 1