Skip to content

Commit

Permalink
fancier oled message during main_menu led test
Browse files Browse the repository at this point in the history
  • Loading branch information
gateherder committed May 7, 2018
1 parent 6d89e30 commit ead69cd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
16 changes: 15 additions & 1 deletion Software/dczia26_combined_test/dczia26_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main_menu(SSD1306 *screen, Keypad *keypd, Adafruit_NeoPixel *ledgrid)
screen->setFont(ArialMT_Plain_10);
screen->setTextAlignment(TEXT_ALIGN_LEFT);
screen->clear();
screen->println("Main Menu");
screen->println("dczia 2018 proto dos menu");
screen->println("2) led test");
screen->println("3) screen test");
screen->println("A) keypad test");
Expand Down Expand Up @@ -51,10 +51,18 @@ void main_menu(SSD1306 *screen, Keypad *keypd, Adafruit_NeoPixel *ledgrid)
{
Serial.println("main_menu(): case '2'");

screen->clear();
screen->display();
screen->setTextAlignment(TEXT_ALIGN_LEFT);
screen->setFont(ArialMT_Plain_24);

uint8_t i = 0;
int led_delay = 2000;

// red
screen->clear();
screen->drawString(0, 0, "Red!");
screen->display();
for(i=0; i< ledgrid->numPixels(); i++)
{
ledgrid->setPixelColor(i, ledgrid->Color(255, 0, 0));
Expand All @@ -63,6 +71,9 @@ void main_menu(SSD1306 *screen, Keypad *keypd, Adafruit_NeoPixel *ledgrid)
delay(led_delay);

// green
screen->clear();
screen->drawString(0, 0, "Green!");
screen->display();
for(i=0; i< ledgrid->numPixels(); i++)
{
ledgrid->setPixelColor(i, ledgrid->Color(0, 255, 0));
Expand All @@ -71,6 +82,9 @@ void main_menu(SSD1306 *screen, Keypad *keypd, Adafruit_NeoPixel *ledgrid)
delay(led_delay);

// blue
screen->clear();
screen->drawString(0, 0, "Blue!");
screen->display();
for(i=0; i< ledgrid->numPixels(); i++)
{
ledgrid->setPixelColor(i, ledgrid->Color(0, 0, 255));
Expand Down
12 changes: 6 additions & 6 deletions Software/dczia26_combined_test/dczia26_oled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ SSD1306* oled_setup(void)
screen->setContrast(255);

// Initialize the log buffer
// allocate memory to store 8 lines of text and 30 chars per line.
screen->setLogBuffer(5, 30);
// allocate memory to store 8 lines of text and 25 chars per line.
screen->setLogBuffer(5, 25);

screen->clear();

Expand All @@ -52,22 +52,22 @@ void oled_welcome(SSD1306 *screen)
screen->display();
delay(1000);
screen->clear();
screen->println("4..");
screen->print("4..");
screen->drawLogBuffer(0, 0);
screen->display();
delay(1000);
screen->clear();
screen->println("3..");
screen->print("3..");
screen->drawLogBuffer(0, 0);
screen->display();
delay(1000);
screen->clear();
screen->println("2..");
screen->print("2..");
screen->drawLogBuffer(0, 0);
screen->display();
delay(1000);
screen->clear();
screen->println("1..");
screen->print("1..");
screen->drawLogBuffer(0, 0);
screen->display();
delay(1000);
Expand Down

0 comments on commit ead69cd

Please sign in to comment.