MicroView Hookup Guide

Pages
Contributors: Joel_E_B, Marcus Schappi
Favorited Favorite 8

Example 2 - Basic Drawing

In this example, we're going to try some basic drawing. This sketch demonstrates the MicroView's many drawing functions, including pixels, lines, circles and rectangles.

It also introduces the setCursor() function, which allows you to move the cursor and print text or draw shapes at different locations other than the origin (0,0).

Copy the following code, paste it into the Arduino IDE and click upload.

language:c
#include <MicroView.h>

void setup() {
    uView.begin();
    uView.clear(PAGE);      // clear the page buffer
}

void loop() {
    uView.line(0,0,64,48);
    uView.circle(32,24,10);
    uView.rect(10,10,20,20);
    uView.pixel(50,5);
    uView.setCursor(0,40);
    uView.print(" MicroView");
    uView.display();        // display current page buffer
}

Once uploaded, you should see various images appear on the display.

Check out the MicroView Class Reference page for more information on drawing.