/************************************************************************
*
* Test of the Pmod
*
*************************************************************************
* Description: Pmod_OLED
* A cloud of points is displayed randomly
* then the Message lextronic appears and flashes 3 times.
*
* Material
* 1. Arduino Uno
* 2. Pmod OLED
* (Download libraries https://github.com/adafruit/Adafruit_SSD1306 et
* https://github.com/adafruit/Adafruit-GFX-Library)
*
************************************************************************/
// Affectation of pins
#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
// Call of libraries
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SPI.h>
Adafruit_SSD1306 afficheur(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
//creation of object
int x;
int y;
void setup(void)
{
afficheur.begin(); // initialization of display object
afficheur.display(); // refresh display
afficheur.clearDisplay(); // erase display
afficheur.display(); // refresh display
}
void loop()
{
afficheur.clearDisplay(); // erase display
afficheur.display(); // refresh display
for (int i=0; i <= 50; i++) // display cloud of points
{
x=random(128); // x take random value from 0 to 128
y=random(32); // y take random value from 0 et 32
afficheur.drawPixel(x, y, WHITE); // Display pixel at (x,y)
afficheur.display(); // refresh display
delay(50); // wait 50 ms
}
afficheur.setTextSize(2); // configuration of size of caracters caractères
afficheur.setTextColor(WHITE);
afficheur.setCursor(10,10); // set cursor at x=10 and y=10
afficheur.println("LEXTRONIC"); // display LEXTRONIC
afficheur.display(); // refresh display
delay(1000);
for (int i=0; i <= 3; i++) // the message blink
{
afficheur.setCursor(10,10);
afficheur.println("LEXTRONIC");
afficheur.display();
delay(1000);
afficheur.clearDisplay();
afficheur.display();
delay(500);
}
}
Comments
Please log in or sign up to comment.