Things used in this project

Code

NokiaTest1.inoPlain text
NokiaTest1.ino
/*

  This implementation specific to Arduino Mini-Pro 328 running at 3.3V

  and used with a NOKIA 5110 Craphic LCD.



  Built under Arduino 1.0.5

*/



#include <EEPROM.h>

#include <Streaming.h>

#include "Defines.h"                // Nokia 5110 LCD pin usage as controlled by "ScrnFuncts.ino"



// constants

const int  BAUD            = 9600;  // any standard serial value: 300 - 115200

const int  EEaddr          = 0;     // EEPROM address for storing WPM

const int  EEaddr1         = 2;     // EEPROM address for LCD address

// Arduino 328P pins (not physical)



const byte ContrastPin     = 8;     // D8 low activates the Contrast adjustment



// global prog variables



byte nRow;                          // line count      (0-5 for NOKIA LCD)

byte nColumn;                       // character count (0-11 for NOKIA LCD)

byte NOKIAcontrast;                 // LCD initialization contrast values B0 thru BF



char temp;



// Character array pointers

char* PROGMEM msg0[]       = {"TerminalTest(C)2014 by  M. Burnette                         Ver 0.000000"}; // 72 characters == full screen

char* PROGMEM msg1[]       = {"The quick   Brown Fox   Jumps over  The Lazy DogBack        Press ENTER "};

char* PROGMEM BlankLine[]  = {"            "};  // Nokia 12 x 6 (84 * 48)





void setup(void)

  { 



    pinMode(ContrastPin, INPUT);

    digitalWrite(ContrastPin, HIGH); // activate internal pullup resistor





    Serial.begin(BAUD);

    Serial << (F("(c) 2013 - 2014 by M. R. Burnette")) << endl;

    Serial << (F("Free RAM available: ")) ;

    Serial << freeRam() << endl;

    Serial << (F("Version 0.20140126")) << endl;

    ReStart:  // Come back here if LCD contract is changed

    // Read the EEPROM to determine if display is using a custom contrast value

    NOKIAcontrast = EEPROM.read(EEaddr1);

    // Set the Nokia LCD Contrast to default or reset if EEPROM is corrupt or set to new value

    if (NOKIAcontrast  < 0xB0 || NOKIAcontrast > 0xBF) NOKIAcontrast = 0xB2;

    // LCD

    LcdInitialise();

    LcdClear();

    LcdString(*msg0);

    delay(2000);

    if (!digitalRead(ContrastPin)) {

        NOKIAcontrast++;

        if (NOKIAcontrast > 0xBF) NOKIAcontrast = 0xB0;

        EEPROM.write(EEaddr1, NOKIAcontrast);

        goto ReStart;

    }

    // Set WPM default and write to EEPROM IF Morse Key is closed at this point...



    LcdClear(); delay(500); nRow = 1;

    LcdString(*msg1);

    nRow = 0; nColumn = 0;

    gotoXY(nColumn, nRow);

    do {} while (Serial.available() == 0) ;

    LcdClear();  // nRow = 0; nColumn = 0 done by function LcdClear()

}





void loop(void)

{

    if (Serial.available() > 0)

    {

      char temp = Serial.read();

      Serial << temp;  // for diagnostic and Arduino term echo

      switch (temp)

        {

          case '\n' :

            ++nRow; nColumn = 0;

            if (nRow == 6) nRow = 0;

            LcdString(BlankLine[0]);  // clear line



          case '\r' :

            ++nRow; nColumn = 0;

            if (nRow == 6) nRow = 0;

            LcdString(BlankLine[0]);  // clear line



          default :

            gotoXY(nColumn, nRow);

            if (temp > 31 && temp < 128) SendCharLCD(temp);

            if (nColumn == 0 ) LcdString(BlankLine[0]);  // clear new line

        }

    }

}

Credits

Coffeemath
Ray Burnette

IT architect - retired AT&T... USAF-Secure Comm , Burroughs, Clemson U. School of EE Research, Southern Bell, BellSouth, SofKinetics, Inc. (President), AT&T IT

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Picture The Weather
  • 30,086
  • 85

Full instructions

In this sample, we will connect an RGB LED strip to an Arduino and control it to indicate the weather forecast behind a picture.

WiFi Weather Station
  • 14,575
  • 38

Work in progress

An Arduino powered internet connected weather station sending data to weather underground for storage and viewing.

Toothbrush machine
  • 6,819
  • 62

Full instructions

Because knowing how to build something doesn't always mean you should.

Arduino and Android Based Bluetooth Password Lock
  • 9,427
  • 25

Full instructions

We everybody are concerned about the security of our home. World becoming smarter and smarter everyday and we want to control and secured...

DIY Arduino Dot Matrix Wrist Watch
  • 488
  • 7

Full instructions

My diy arduino dot matrix wrist watch shows time, date and temperature in two different form, BCD binary format and digital format.

LED Drawing with Virtual Shields
  • 4,721
  • 23

Full instructions

In this sample, we will connect an RGB LED strip to an Arduino and hand draw the lights through a Windows 10 phone over Bluetooth.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login