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

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

Unlock your door with a knock
  • 13,393
  • 45

Full instructions

Open your door with a special knock using Arduino, Android Phone and 1Sheeld

DIY Relay Outlet Arduino
  • 18,908
  • 22

Full instructions

Control a wall outlet using an Arduino using this DIY solid state relay outlet.

Uber Home Automation
  • 22,909
  • 110

Work in progress

Wireless Arduino sensor nodes and awesome home automation platform called OpenHAB.  Know when your dog barks.

Magoo
  • 4,440
  • 25

Work in progress

An obstacle-detection and GPS-enabled navigation wearable for the visually impaired.

Magoo

4 members

Arduino to Excel using V-USB
  • 30,364
  • 30

Full instructions

Log 6 analog and 8 digital pins from Arduino Uno simultaneously in Excel.

Magic Morse on Arduino
  • 16,803
  • 20

Full instructions

Learn or sharpen your Morse Code skills with Magic Morse implemented on Arduino!

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback