1Sheeld GLCD Scrolling Text

1Sheeld GLCD Scrolling Text

Sample project to show how to display text on the new GLDC shield for 1Sheeld.

  • 923 views
  • 0 comments
  • 9 respects

Components and supplies

About this project

Background:

I created this simple project to understand how to display text on the new GLCD shield of 1Sheeld.  This code can be used as a starting point for your own project to display status/update messages using the GLCD shield of 1Sheeld.


Basic Function:

The title line stays static ( but can be changed ) and the rest of the lines do a scrolling type of function for updates.  My code does a simple loop of the days of the week to show how it works.


How to use this project:

1) Copy the code into your IDE environment

2) Load code onto your Arduino UNO (with 1Sheeld attached).  Make sure the UART switch on the 1Sheeld is in uploading mode.

3) Connect to your 1Sheeld using your smartphone and the 1Sheeld application, make sure you select the GLCD shield.

4) Make sure the UART switch on the 1Sheeld is in the operating mode, reset your UNO.

5) Watch the updates on the 1Sheeld application / GLCD shield.


Possible use of this code in your own code:

If you only want to display status messages, the 1Sheeld "terminal" shield might work better, but if you want a mix of text that includes static and updated fields, the GLCD is a good option to test.  This code should give you a starting point to play around with the GLCD text display options.

Code

Arduino UNO CodeC/C++
/* 1Sheeld related */
#define CUSTOM_SETTINGS
#define INCLUDE_GLCD_SHIELD
#include <OneSheeld.h>

/* GLCD Setup */
GLCDTextBox textBoxTitle(1, 5, "Title");
GLCDTextBox textBox1(5, 20, "L1");
GLCDTextBox textBox2(5, 30, "L2");
GLCDTextBox textBox3(5, 40, "L3");
GLCDTextBox textBox4(5, 50, "L4");
GLCDTextBox textBox5(5, 60, "L5");
GLCDTextBox textBox6(5, 70, "L6");
GLCDTextBox textBox7(5, 80, "L7");
GLCDTextBox textBox8(5, 90, "L8");
GLCDTextBox textBox9(5, 100, "L9");
GLCDTextBox textBox10(5,110, "L10");

/* Setup variables */
char * line1 = ".";
char * line2 = ".";
char * line3 = ".";
char * line4 = ".";
char * line5 = ".";
char * line6 = ".";
char * line7 = ".";
char * line8 = ".";
char * line9 = ".";
char * line10 = ".";

void setup() {
  /* Start communication with 1Sheeld. */
  OneSheeld.begin();

  /* Clear the 1Sheeld GLCD, and draw the text boxes */
  GLCD.clear();
  GLCD.draw(textBoxTitle);
  GLCD.draw(textBox1);
  GLCD.draw(textBox2);
  GLCD.draw(textBox3);
  GLCD.draw(textBox4);
  GLCD.draw(textBox5);
  GLCD.draw(textBox6);
  GLCD.draw(textBox7);
  GLCD.draw(textBox8);
  GLCD.draw(textBox9);
  GLCD.draw(textBox10);

  /*
   * The first line of the GLCD on this project doesn't not scroll.
   * You can change the title (top line) when you want using the line below
   */
  textBoxTitle.setText("Set your title here");
}

void loop() {
  /*
   * The code below is simply to show the scrolling in progress.
   */
  delay(1000);
  textBoxTitle.setText("Days of the week");
  ScrollMsg("Sunday");
  ScrollMsg("Monday");
  ScrollMsg("Tuesday");
  ScrollMsg("Wednesday");
  ScrollMsg("Thursday");
  ScrollMsg("Friday");
  ScrollMsg("Saturday");
}

void ScrollMsg(char * a)
{
  /* The lines below shift the text to the prior line's variable
   * For example, what was line on line8 is copied to line9's variable
  */
  line10 = line9;
  line9 = line8;
  line8 = line7;
  line7 = line6;
  line6 = line5;
  line5 = line4;
  line4 = line3;
  line3 = line2;
  line2 = line1;
  line1 = a;

  /*
   * This code actually updates the text for each of the lines
   */
  textBox1.setText(line1);
  textBox2.setText(line2);
  textBox3.setText(line3);
  textBox4.setText(line4);
  textBox5.setText(line5);
  textBox6.setText(line6);
  textBox7.setText(line7);
  textBox8.setText(line8);
  textBox9.setText(line9);
  textBox10.setText(line10);
}

Comments

Similar projects you might like

Arduino Bluetooth Basic Tutorial

by Mayoogh Girish

  • 454,764 views
  • 42 comments
  • 238 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 286,902 views
  • 95 comments
  • 674 respects

Security Access Using RFID Reader

by Aritro Mukherjee

  • 231,234 views
  • 40 comments
  • 241 respects

OpenCat

Project in progress by Team Petoi

  • 196,442 views
  • 154 comments
  • 1,366 respects
Add projectSign up / Login