Skip to content

Instantly share code, notes, and snippets.

@Pharap
Created August 22, 2020 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pharap/abff335bf18ab5092934c5f8ed37ed4b to your computer and use it in GitHub Desktop.
Save Pharap/abff335bf18ab5092934c5f8ed37ed4b to your computer and use it in GitHub Desktop.
Demonstrating different combinations of text parameters on Arduboy
#include <Arduboy2.h>
Arduboy2 arduboy;
// This code is under the CC0 licence
// and hence is in the public domain,
// or your local equivalent.
void setup()
{
arduboy.begin();
}
void loop()
{
if(!arduboy.nextFrame())
return;
arduboy.pollButtons();
arduboy.clear();
arduboy.fillRect(0, 0, 16, HEIGHT, WHITE);
// These are the legal permutations
{
arduboy.setTextColor(WHITE);
arduboy.setTextBackground(BLACK);
arduboy.println(F("Hello"));
arduboy.setTextColor(BLACK);
arduboy.setTextBackground(WHITE);
arduboy.println(F("Hello"));
arduboy.setTextColor(BLACK);
arduboy.setTextBackground(BLACK);
arduboy.println(F("Hello"));
arduboy.setTextColor(WHITE);
arduboy.setTextBackground(WHITE);
arduboy.println(F("Hello"));
}
// These are the permutations that the API considers 'illegal'
{
arduboy.setTextColor(WHITE);
arduboy.setTextBackground(4);
arduboy.println(F("Hello"));
arduboy.setTextColor(2);
arduboy.setTextBackground(4);
arduboy.println(F("Hello"));
arduboy.setTextColor(2);
arduboy.setTextBackground(WHITE);
arduboy.println(F("Hello"));
arduboy.setTextColor(2);
arduboy.setTextBackground(2);
arduboy.println(F("Hello"));
}
arduboy.display();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment