Display::Display() { _currentRow = 0; _currentColumn = 0; #ifdef LCD_IS_SERIAL // _SerialLCD = new SoftwareSerial(LCD_RX_PIN, LCD_TX_PIN); // _SerialLCD->begin(9600); Serial.begin(9600); _blankline = String(""); for(int i = 0; i < LCD_COLUMN_COUNT; i++) _blankline.concat(' '); clearBuffer(); SetCursor(_currentRow, _currentColumn); #else // Not LCD_IS_SERIAL // If anyone wants RW support, we should add it here. #ifdef LCD_USE_8_PINS *_lcd = LiquidCrystal(LCD_PIN_RS, LCD_PIN_ENABLE, LCD_PIN_D0, LCD_PIN_D1, LCD_PIN_D2, LCD_PIN_D3, LCD_PIN_D4, LCD_PIN_D5, LCD_PIN_D6,LCD_PIN_D7); #else // Assume 4 pins *_lcd = LiquidCrystal(LCD_PIN_RS, LCD_PIN_ENABLE, LCD_PIN_D4, LCD_PIN_D5, LCD_PIN_D6,LCD_PIN_D7); #endif // LCD_USE_8_PINS #endif // (else not) LCD_IS_SERIAL }
int main(void){ //RS, RW (255 for disabled), E, 4 bit Y/N LiquidCrystal lcd = LiquidCrystal(PD7,255,PD5,1); setup_tmr(); setup_adc(); sei(); //Enable interrupts while(1){ //If buffer is full, do pitch calculation and compare } return 0; }
/*********************************************************** * * uiPowerOn * ***********************************************************/ void TTUI::uiPowerOn() { if(state_UIPower == false) //if ui power off { state_UIPower = true; previousMillis_UIPower = millis(); //clock countdown start time #ifdef TT_SHIELD touch.begin(); #else //Normal TT PORTB &= ~ (1<<PORTB6); // enable Vsw power to touch IC and LCD delay (150); // wait for power to stabilize and hw to start touch.begin(KEY_CHANGE); //re init touch keys if(onBatteryPower == false) //USB connected { #ifdef SERIAL_DEBUG Serial.println("USB"); #endif } else //battery power { // restart the LCD LiquidCrystal(A3,4,5, 6, 7, 8, 9); begin(8,2); display(); // test battery level and set LCD contrast PWM long lcdContrast = analogRead(A1); lcdContrast = 175 - ((lcdContrast * 5) / 32); analogWrite (10, lcdContrast); } #endif //ifdef TT_SHIELD #ifdef SERIAL_DEBUG Serial.println("UI On"); #endif } }
#include "DisplayManager.h" LiquidCrystal DisplayManager::lcd = LiquidCrystal(LCDRS, LCDEN, LCDD4, LCDD5, LCDD6, LCDD7); int DisplayManager::display_mode = -1; uint8_t DisplayManager::current_menu = MAINMENU; unsigned long DisplayManager::iterations = 0; int DisplayManager::year = 0; byte DisplayManager::month = 0; byte DisplayManager::day = 0; byte DisplayManager::hour = 0; byte DisplayManager::minutes = 0; byte DisplayManager::seconds = 0; double DisplayManager::latitude = 0; double DisplayManager::longitude = 0; long DisplayManager::altitude = 0; byte DisplayManager::satellites = 0; // Init LCD display void DisplayManager::init() { lcd.begin(8, 2); delay(20); lcd.print(F("init")); } // Disp error void DisplayManager::error() {
// Main.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <windows.h> #include <stdio.h> #include <VersionHelpers.h> int RS = 4; int ENABLE = 5; int D0 = 6; int D1 = 7; int D2 = 8; int D3 = 9; LiquidCrystal lcd = LiquidCrystal(RS, ENABLE, D0, D1, D2, D3); // define our LCD and which pins to use int _tmain(int argc, _TCHAR* argv[]) { return RunArduinoSketch(); } void setup() { Log(L"LCD Sample\n"); lcd.begin(16, 2); // need to specify how many columns and rows are in the LCD unit (it calls clear at the end of begin) lcd.setCursor(0, 0); lcd.print("Hello Habrahabr!"); }