6 Commits

Author SHA1 Message Date
JP
abacd6b7bc added Learning Kit Circuit Sketch 2014-07-26 10:13:31 +10:00
JP Liew
b577e9e538 fixed tab spaces 2014-06-26 21:40:36 +10:00
JP Liew
ff388744a6 added more documentation 2014-06-26 21:20:49 +10:00
JP Liew
a7e091c2f9 added comments to support doxygen 2014-06-26 14:38:16 +10:00
JP
91f965f1eb added Sine Wave Example 2014-06-13 12:41:44 +10:00
JP
3c5c44fe31 removed 12x24Font.h that was used for tutorial 2014-06-12 14:48:46 +10:00
20 changed files with 869 additions and 110 deletions

View File

@@ -1,37 +0,0 @@
//------------------------------------------------------------------------------
// File generated by LCD Assistant
// http://en.radzio.dxp.pl/bitmap_converter/
//------------------------------------------------------------------------------
#ifndef FONT12X24_H
#define FONT12X24_H
#include <avr/pgmspace.h>
static const unsigned char font12x24 [] PROGMEM = {
// first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)
12,24,48,10,1,20,
0x1F, 0x1F, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0x1F, 0x1F, 0xFF, 0xFF, 0x9F, 0x9F, 0x9F, 0x9F,
0x07, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0x9F, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7,
0x1F, 0x1F, 0xFF, 0xFF, 0x9F, 0x9F, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0x1F, 0x1F, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0x07, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x07, 0xE7, 0xE7,
0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xFF, 0xFF, 0x7F, 0x7F, 0x9F, 0x9F, 0xE7, 0xE7, 0xE7, 0xE7,
0xFF, 0xFF, 0xFF, 0xFF, 0x87, 0x87, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0x07, 0x07, 0xFF, 0xFF,
0x1F, 0x1F, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0x1F, 0x1F, 0xFF, 0xFF, 0x1F, 0x1F, 0xE7, 0xE7,
0xE7, 0xE7, 0xE7, 0xE7, 0x1F, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x7F, 0x7F, 0x9F, 0x9F, 0xE7, 0xE7, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xE7, 0xE7, 0xE7, 0xE7, 0x18, 0x18, 0xFF, 0xFF, 0x1F, 0x1F, 0x61, 0x61, 0x7E, 0x7E, 0x00, 0x00,
0x7F, 0x7F, 0xFF, 0xFF, 0xE0, 0xE0, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0x1F, 0x1F, 0xFF, 0xFF,
0x00, 0x00, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x1F, 0x1F, 0xE1, 0xE1, 0xFE, 0xFE, 0xFF, 0xFF, 0x18, 0x18, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7,
0x18, 0x18, 0xFF, 0xFF, 0xF8, 0xF8, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0x00, 0x00, 0xFF, 0xFF,
0xF8, 0xF8, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xF8, 0xF8, 0xFF, 0xFF, 0xE7, 0xE7, 0xE7, 0xE7,
0xE0, 0xE0, 0xE7, 0xE7, 0xE7, 0xE7, 0xFF, 0xFF, 0xE1, 0xE1, 0xE6, 0xE6, 0xE7, 0xE7, 0xE7, 0xE7,
0xE7, 0xE7, 0xFF, 0xFF, 0xF9, 0xF9, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xF8, 0xF8, 0xFF, 0xFF,
0xFE, 0xFE, 0xFE, 0xFE, 0xE6, 0xE6, 0xE0, 0xE0, 0xE6, 0xE6, 0xFF, 0xFF, 0xF9, 0xF9, 0xE7, 0xE7,
0xE7, 0xE7, 0xE7, 0xE7, 0xF8, 0xF8, 0xFF, 0xFF, 0xF8, 0xF8, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7,
0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xE1, 0xE1, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xF8, 0xF8, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0xE7,
0xE7, 0xE7, 0xF9, 0xF9, 0xFE, 0xFE, 0xFF, 0xFF,
};
#endif

View File

@@ -32,8 +32,6 @@
#include <space02.h>
#include <space03.h>
// Change the total fonts included
#define TOTALFONTS 7
#define recvLEN 100
@@ -49,17 +47,17 @@ const unsigned char *MicroView::fontsPointer[]={
,space01
,space02
,space03
};
// TODO - Need to be able to let user add custom fonts from outside of the library
// TODO - getTotalFonts(), addFont() return font number, removeFont()
/*
/** \brief MicroView screen buffer.
Page buffer 64 x 48 divided by 8 = 384 bytes
Page buffer is required because in SPI mode, the host cannot read the SSD1306's GDRAM of the controller. This page buffer serves as a scratch RAM for graphical functions. All drawing function will first be drawn on this page buffer, only upon calling display() function will transfer the page buffer to the actual LCD controller's memory.
*/
static uint8_t screenmemory [] = {
static uint8_t screenmemory [] = {
// LCD Memory organised in 64 horizontal pixel and 6 rows of byte
// B B .............B -----
// y y .............y \
@@ -115,6 +113,10 @@ static uint8_t screenmemory [] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/** \brief Initialisation of MicroView Library.
Setup IO pins for SPI port then send initialisation commands to the SSD1306 controller inside the OLED.
*/
void MicroView::begin() {
// default 5x7 font
setFontType(0);
@@ -197,6 +199,10 @@ void MicroView::begin() {
Serial.begin(115200);
}
/** \brief SPI command.
Setup DC and SS pins, then send command via SPI to SSD1306 controller.
*/
void MicroView::command(uint8_t c) {
// Hardware SPI
*dcreg |= dcpinmask; // Set DC pin to OUTPUT
@@ -213,6 +219,10 @@ void MicroView::command(uint8_t c) {
*dcreg &= ~dcpinmask; // Set DC to INPUT to avoid high voltage over driving the OLED logic
}
/** \brief SPI data.
Setup DC and SS pins, then send data via SPI to SSD1306 controller.
*/
void MicroView::data(uint8_t c) {
// Hardware SPI
*dcport |= dcpinmask; // DC HIGH
@@ -228,21 +238,29 @@ void MicroView::data(uint8_t c) {
*dcreg &= ~dcpinmask; // Set DC to INPUT to avoid high voltage over driving the OLED logic
}
/** \brief Set SSD1306 page address.
Send page address command and address to the SSD1306 OLED controller.
*/
void MicroView::setPageAddress(uint8_t add) {
add=0xb0|add;
command(add);
return;
}
/** \brief Set SSD1306 column address.
Send column address command and address to the SSD1306 OLED controller.
*/
void MicroView::setColumnAddress(uint8_t add) {
command((0x10|(add>>4))+0x02);
command((0x0f&add));
return;
}
/*
Clear GDRAM inside the LCD controller - mode = ALL
Clear screen page buffer - mode = PAGE
/** \brief Clear screen buffer or SSD1306's memory.
To clear GDRAM inside the LCD controller, pass in the variable mode = ALL and to clear screen page buffer pass in the variable mode = PAGE.
*/
void MicroView::clear(uint8_t mode) {
// uint8_t page=6, col=0x40;
@@ -262,9 +280,9 @@ void MicroView::clear(uint8_t mode) {
}
}
/*
Clear GDRAM inside the LCD controller - mode = ALL with c character.
Clear screen page buffer - mode = PAGE with c character.
/** \brief Clear or replace screen buffer or SSD1306's memory with a character.
To clear GDRAM inside the LCD controller, pass in the variable mode = ALL with c character and to clear screen page buffer, pass in the variable mode = PAGE with c character.
*/
void MicroView::clear(uint8_t mode, uint8_t c) {
//uint8_t page=6, col=0x40;
@@ -284,6 +302,10 @@ void MicroView::clear(uint8_t mode, uint8_t c) {
}
}
/** \brief Invert display.
The WHITE color of the display will turn to BLACK and the BLACK will turn to WHITE.
*/
void MicroView::invert(boolean inv) {
if (inv)
command(INVERTDISPLAY);
@@ -291,12 +313,19 @@ void MicroView::invert(boolean inv) {
command(NORMALDISPLAY);
}
/** \brief Set contrast.
OLED contract value from 0 to 255. Note: Contrast level is not very obvious.
*/
void MicroView::contrast(uint8_t contrast) {
command(SETCONTRAST); // 0x81
command(contrast);
}
// This routine is to transfer the page buffer to the LCD controller's memory.
/** \brief Transfer display memory.
Bulk move the screen buffer to the SSD1306 controller's memory so that images/graphics drawn on the screen buffer will be displayed on the OLED.
*/
void MicroView::display(void) {
uint8_t i, j;
@@ -309,11 +338,16 @@ void MicroView::display(void) {
}
}
#if ARDUINO >= 100
//#if ARDUINO >= 100
/** \brief Override Arduino's Print.
Arduino's print overridden so that we can use uView.print().
*/
size_t MicroView::write(uint8_t c) {
#else
void MicroView::write(uint8_t c) {
#endif
//#else
// void MicroView::write(uint8_t c) {
//#endif
if (c == '\n') {
cursorY += fontHeight;
cursorX = 0;
@@ -327,20 +361,32 @@ size_t MicroView::write(uint8_t c) {
cursorX = 0;
}
}
#if ARDUINO >= 100
//#if ARDUINO >= 100
return 1;
#endif
//#endif
}
void MicroView::setCursor(uint8_t x, uint8_t y) {
/** \brief Set cursor position.
MicroView's cursor position to x,y.
*/
void MicroView::setCursor(uint8_t x, uint8_t y) {
cursorX=x;
cursorY=y;
}
/** \brief Draw pixel.
Draw pixel using the current fore color and current draw mode in the screen buffer's x,y position.
*/
void MicroView::pixel(uint8_t x, uint8_t y) {
pixel(x,y,foreColor,drawMode);
}
/** \brief Draw pixel with color and mode.
Draw color pixel in the screen buffer's x,y position with NORM or XOR draw mode.
*/
void MicroView::pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode) {
if ((x<0) || (x>=LCDWIDTH) || (y<0) || (y>=LCDHEIGHT))
return;
@@ -359,13 +405,18 @@ size_t MicroView::write(uint8_t c) {
//display();
}
// Draw line using current fore color and current draw mode
/** \brief Draw line.
Draw line using current fore color and current draw mode from x0,y0 to x1,y1 of the screen buffer.
*/
void MicroView::line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) {
line(x0,y0,x1,y1,foreColor,drawMode);
}
// Draw line using color and mode
// bresenham's algorithm
/** \brief Draw line with color and mode.
Draw line using color and mode from x0,y0 to x1,y1 of the screen buffer.
*/
void MicroView::line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color, uint8_t mode) {
uint8_t steep = abs(y1 - y0) > abs(x1 - x0);
if (steep) {
@@ -404,32 +455,50 @@ size_t MicroView::write(uint8_t c) {
}
}
// Draw horizontal line using current fore color and current draw mode
/** \brief Draw horizontal line.
Draw horizontal line using current fore color and current draw mode from x,y to x+width,y of the screen buffer.
*/
void MicroView::lineH(uint8_t x, uint8_t y, uint8_t width) {
line(x,y,x+width,y,foreColor,drawMode);
}
// Draw horizontal line using color and draw mode
/** \brief Draw horizontal line with color and mode.
Draw horizontal line using color and mode from x,y to x+width,y of the screen buffer.
*/
void MicroView::lineH(uint8_t x, uint8_t y, uint8_t width, uint8_t color, uint8_t mode) {
line(x,y,x+width,y,color,mode);
}
// Draw vertical line using current fore color and current draw mode
/** \brief Draw vertical line.
Draw vertical line using current fore color and current draw mode from x,y to x,y+height of the screen buffer.
*/
void MicroView::lineV(uint8_t x, uint8_t y, uint8_t height) {
line(x,y,x,y+height,foreColor,drawMode);
}
// Draw vertical line using color and draw mode
/** \brief Draw vertical line with color and mode.
Draw vertical line using color and mode from x,y to x,y+height of the screen buffer.
*/
void MicroView::lineV(uint8_t x, uint8_t y, uint8_t height, uint8_t color, uint8_t mode) {
line(x,y,x,y+height,color,mode);
}
// Draw rectangle using current fore color and current draw mode
/** \brief Draw rectangle.
Draw rectangle using current fore color and current draw mode from x,y to x+width,y+height of the screen buffer.
*/
void MicroView::rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height) {
rect(x,y,width,height,foreColor,drawMode);
}
// Draw rectangle using color and draw mode
/** \brief Draw rectangle with color and mode.
Draw rectangle using color and mode from x,y to x+width,y+height of the screen buffer.
*/
void MicroView::rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color , uint8_t mode) {
uint8_t tempHeight;
@@ -446,13 +515,18 @@ size_t MicroView::write(uint8_t c) {
lineV(x+width-1, y+1, tempHeight, color, mode);
}
/** \brief Draw filled rectangle.
// Draw filled rectangle using current fore color and current draw mode
Draw filled rectangle using current fore color and current draw mode from x,y to x+width,y+height of the screen buffer.
*/
void MicroView::rectFill(uint8_t x, uint8_t y, uint8_t width, uint8_t height) {
rectFill(x,y,width,height,foreColor,drawMode);
}
// Draw filled rectangle using color and mode
/** \brief Draw filled rectangle with color and mode.
Draw filled rectangle using color and mode from x,y to x+width,y+height of the screen buffer.
*/
void MicroView::rectFill(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color , uint8_t mode) {
// TODO - need to optimise the memory map draw so that this function will not call pixel one by one
for (int i=x; i<x+width;i++) {
@@ -460,12 +534,18 @@ size_t MicroView::write(uint8_t c) {
}
}
// Draw circle using current fore color and current draw mode
/** \brief Draw circle.
Draw circle with radius using current fore color and current draw mode at x,y of the screen buffer.
*/
void MicroView::circle(uint8_t x0, uint8_t y0, uint8_t radius) {
circle(x0,y0,radius,foreColor,drawMode);
}
// Draw circle using color and mode
/** \brief Draw circle with color and mode.
Draw circle with radius using color and mode at x,y of the screen buffer.
*/
void MicroView::circle(uint8_t x0, uint8_t y0, uint8_t radius, uint8_t color, uint8_t mode) {
//TODO - find a way to check for no overlapping of pixels so that XOR draw mode will work perfectly
int8_t f = 1 - radius;
@@ -502,13 +582,18 @@ size_t MicroView::write(uint8_t c) {
}
}
/** \brief Draw filled circle.
// Draw filled circle using current fore color and current draw mode
Draw filled circle with radius using current fore color and current draw mode at x,y of the screen buffer.
*/
void MicroView::circleFill(uint8_t x0, uint8_t y0, uint8_t radius) {
circleFill(x0,y0,radius,foreColor,drawMode);
}
// Draw filled circle using color and mode
/** \brief Draw filled circle with color and mode.
Draw filled circle with radius using color and mode at x,y of the screen buffer.
*/
void MicroView::circleFill(uint8_t x0, uint8_t y0, uint8_t radius, uint8_t color, uint8_t mode) {
// TODO - - find a way to check for no overlapping of pixels so that XOR draw mode will work perfectly
int8_t f = 1 - radius;
@@ -545,38 +630,74 @@ size_t MicroView::write(uint8_t c) {
}
}
/** \brief Get LCD height.
The height of the LCD return as byte.
*/
uint8_t MicroView::getLCDHeight(void) {
return LCDHEIGHT;
}
/** \brief Get LCD width.
The width of the LCD return as byte.
*/
uint8_t MicroView::getLCDWidth(void) {
return LCDWIDTH;
}
/** \brief Get font width.
The cucrrent font's width return as byte.
*/
uint8_t MicroView::getFontWidth(void) {
return fontWidth;
}
/** \brief Get font height.
The current font's height return as byte.
*/
uint8_t MicroView::getFontHeight(void) {
return fontHeight;
}
/** \brief Get font starting character.
Return the starting ASCII character of the currnet font, not all fonts start with ASCII character 0. Custom fonts can start from any ASCII character.
*/
uint8_t MicroView::getFontStartChar(void) {
return fontStartChar;
}
/** \brief Get font total characters.
Return the total characters of the current font.
*/
uint8_t MicroView::getFontTotalChar(void) {
return fontTotalChar;
}
/** \brief Get total fonts.
Return the total number of fonts loaded into the MicroView's flash memory.
*/
uint8_t MicroView::getTotalFonts(void) {
return TOTALFONTS;
}
/** \brief Get font type.
Return the font type number of the current font.
*/
uint8_t MicroView::getFontType(void) {
return fontType;
}
/** \brief Set font type.
Set the current font type number, ie changing to different fonts base on the type provided.
*/
uint8_t MicroView::setFontType(uint8_t type) {
if ((type>=TOTALFONTS) || (type<0))
return false;
@@ -590,20 +711,34 @@ size_t MicroView::write(uint8_t c) {
return true;
}
/** \brief Set color.
Set the current draw's color. Only WHITE and BLACK available.
*/
void MicroView::setColor(uint8_t color) {
foreColor=color;
}
/** \brief Set draw mode.
Set current draw mode with NORM or XOR.
*/
void MicroView::setDrawMode(uint8_t mode) {
drawMode=mode;
}
// Draw character using current fore color and current draw mode
/** \brief Draw character.
Draw character c using current color and current draw mode at x,y.
*/
void MicroView::drawChar(uint8_t x, uint8_t y, uint8_t c) {
drawChar(x,y,c,foreColor,drawMode);
}
// Draw character using color and mode
/** \brief Draw character with color and mode.
Draw character c using color and draw mode at x,y.
*/
void MicroView::drawChar(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode) {
// TODO - New routine to take font of any height, at the moment limited to font height in multiple of 8 pixels
@@ -696,10 +831,18 @@ size_t MicroView::write(uint8_t c) {
}
/** \brief Stop scrolling.
Stop the scrolling of graphics on the OLED.
*/
void MicroView::scrollStop(void){
command(DEACTIVATESCROLL);
}
/** \brief Right scrolling.
Set row start to row stop on the OLED to scroll right. Refer to http://learn.microview.io/intro/general-overview-of-microview.html for explanation of the rows.
*/
void MicroView::scrollRight(uint8_t start, uint8_t stop){
if (stop<start) // stop must be larger or equal to start
return;
@@ -714,6 +857,10 @@ size_t MicroView::write(uint8_t c) {
command(ACTIVATESCROLL);
}
/** \brief Vertical flip.
Flip the graphics on the OLED vertically.
*/
void MicroView::flipVertical(boolean flip) {
if (flip) {
command(COMSCANINC);
@@ -722,7 +869,11 @@ size_t MicroView::write(uint8_t c) {
command(COMSCANDEC);
}
}
/** \brief Horizontal flip.
Flip the graphics on the OLED horizontally.
*/
void MicroView::flipHorizontal(boolean flip) {
if (flip) {
command(SEGREMAP | 0x0);
@@ -732,6 +883,10 @@ size_t MicroView::write(uint8_t c) {
}
}
/** \brief Parse command.
Command stored in serCmd array will be parsed to performed draw functions.
*/
void MicroView::doCmd(uint8_t cmdCount) {
// decode command
switch (serCmd[0]) {
@@ -1097,6 +1252,10 @@ size_t MicroView::write(uint8_t c) {
}
}
/** \brief Listen for serial command.
Instruct the MicroView to check for serial command from the UART.
*/
void MicroView::checkComm(void) {
int count = readSerial();
char *result;
@@ -1129,12 +1288,17 @@ size_t MicroView::write(uint8_t c) {
for (uint8_t i=0;i<index;i++) {
Serial.println(serCmd[i]);
}
*/
*/
}
doCmd(index-1); // index-1 is the total parameters count of a command
}
}
/** \brief Read serial port.
Check for data from the serial port (UART) and store to serInStr array.
*/
int MicroView::readSerial(void)
{
int i=0;
@@ -1158,6 +1322,11 @@ size_t MicroView::write(uint8_t c) {
// -------------------------------------------------------------------------------------
// MicroViewWidget Class - start
// -------------------------------------------------------------------------------------
/** \brief MicroView widget parent class.
The MicroViewWidget class is the parent class for child widget like MicroViewSlider and MicroViewGauge.
*/
MicroViewWidget::MicroViewWidget(uint8_t newx, uint8_t newy, int16_t min, int16_t max) {
setX(newx);
setY(newy);
@@ -1166,19 +1335,52 @@ size_t MicroView::write(uint8_t c) {
setMaxValue(max);
}
/** \brief Get widget x position. */
uint8_t MicroViewWidget::getX() { return x; }
/** \brief Get widget y position. */
uint8_t MicroViewWidget::getY() { return y; }
/** \brief Set widget x position. */
void MicroViewWidget::setX(uint8_t newx) { x = newx; }
/** \brief Set widget y position. */
void MicroViewWidget::setY(uint8_t newy) { y = newy; }
/** \brief Get minimum value.
Return the minimum value of the widget.
*/
int16_t MicroViewWidget::getMinValue() { return minValue; }
/** \brief Get maximum value.
Return the maximum value of the widget.
*/
int16_t MicroViewWidget::getMaxValue() { return maxValue; }
/** \brief Get current value.
Return the current value of the widget.
*/
int16_t MicroViewWidget::getValue() { return value; }
/** \brief Set minimum value.
The minimum value of the widget is set to the variable passed in.
*/
void MicroViewWidget::setMinValue(int16_t min) { minValue=min; }
/** \brief Set maximum value.
The maximum value of the widget is set to the variable passed in.
*/
void MicroViewWidget::setMaxValue(int16_t max) { maxValue=max; }
/** \brief Set current value.
The current value of the widget is set to the variable passed in.
*/
void MicroViewWidget::setValue(int16_t val) {
if ((val<=maxValue) && (val>=minValue)){
value=val;
@@ -1194,6 +1396,10 @@ size_t MicroView::write(uint8_t c) {
// Slider Widget - start
// -------------------------------------------------------------------------------------
/** \brief MicroViewSlider class initilisation.
Initialise the MicroViewSlider widget with default style.
*/
MicroViewSlider::MicroViewSlider(uint8_t newx, uint8_t newy, int16_t min, int16_t max):MicroViewWidget(newx, newy, min, max) {
style=0;
totalTicks=30;
@@ -1203,6 +1409,10 @@ size_t MicroView::write(uint8_t c) {
draw();
}
/** \brief MicroViewSlider class initialisation with style.
Initialise the MicroViewSlider widget with style WIDGETSTYLE0 or WIDGETSTYLE1.
*/
MicroViewSlider::MicroViewSlider(uint8_t newx, uint8_t newy, int16_t min, int16_t max, uint8_t sty):MicroViewWidget(newx, newy, min, max) {
if (sty==WIDGETSTYLE0) {
style=0;
@@ -1219,7 +1429,10 @@ size_t MicroView::write(uint8_t c) {
draw();
}
/** \brief Draw widget face.
Draw image/diagram representing the widget's face.
*/
void MicroViewSlider::drawFace() {
uint8_t offsetX, offsetY, majorLine;
offsetX=getX();
@@ -1261,6 +1474,10 @@ size_t MicroView::write(uint8_t c) {
}
/** \brief Draw widget value.
Convert the current value of the widget and draw the ticker representing the value.
*/
void MicroViewSlider::draw() {
uint8_t offsetX, offsetY;
uint8_t tickPosition=0;
@@ -1303,6 +1520,10 @@ size_t MicroView::write(uint8_t c) {
// Gauge Widget - start
// -------------------------------------------------------------------------------------
/** \brief MicroViewGauge class initilisation.
Initialise the MicroViewGauge widget with default style.
*/
MicroViewGauge::MicroViewGauge(uint8_t newx, uint8_t newy, int16_t min, int16_t max):MicroViewWidget(newx, newy, min, max) {
style=0;
radius=15;
@@ -1312,6 +1533,10 @@ size_t MicroView::write(uint8_t c) {
draw();
}
/** \brief MicroViewGauge class initialisation with style.
Initialise the MicroViewGauge widget with style WIDGETSTYLE0 or WIDGETSTYLE1.
*/
MicroViewGauge::MicroViewGauge(uint8_t newx, uint8_t newy, int16_t min, int16_t max, uint8_t sty):MicroViewWidget(newx, newy, min, max) {
if (sty==WIDGETSTYLE0) {
style=0;
@@ -1327,6 +1552,10 @@ size_t MicroView::write(uint8_t c) {
draw();
}
/** \brief Draw widget face.
Draw image/diagram represengint the widget's face.
*/
void MicroViewGauge::drawFace() {
uint8_t offsetX, offsetY, majorLine;
float degreeSec, fromSecX, fromSecY, toSecX, toSecY;
@@ -1356,6 +1585,10 @@ size_t MicroView::write(uint8_t c) {
}
}
/** \brief Draw widget value.
Convert the current value of the widget and draw the ticker representing the value.
*/
void MicroViewGauge::draw() {
uint8_t offsetX, offsetY;
uint8_t tickPosition=0;
@@ -1405,7 +1638,10 @@ size_t MicroView::write(uint8_t c) {
// Slider Widget - end
// -------------------------------------------------------------------------------------
/** \brief SPI Initialisation.
Setup SCK, MOSI pins for SPI transmission.
*/
void MVSPIClass::begin() {
// Set SS to high so a connected chip will be "deselected" by default
digitalWrite(SS, HIGH);
@@ -1431,11 +1667,15 @@ size_t MicroView::write(uint8_t c) {
pinMode(MOSI, OUTPUT);
}
/** \brief End SPI. */
void MVSPIClass::end() {
SPCR &= ~_BV(SPE);
}
/** \brief Set SPI bit order.
Set SPI port bit order with LSBFIRST or MSBFIRST.
*/
void MVSPIClass::setBitOrder(uint8_t bitOrder)
{
if(bitOrder == LSBFIRST) {
@@ -1445,11 +1685,27 @@ size_t MicroView::write(uint8_t c) {
}
}
/** \brief Set SPI data mode.
Set the SPI daa mode: clock polarity and phase. mode - SPI_MODE0, SPI_MODE1, SPI_MODE2, SPI_MODE3.
*/
void MVSPIClass::setDataMode(uint8_t mode)
{
SPCR = (SPCR & ~SPI_MODE_MASK) | mode;
}
/** \brief Set clock divider.
Set the clocl divider of the SPI, default is 4Mhz.
rate: SPI_CLOCK_DIV2
SPI_CLOCK_DIV4
SPI_CLOCK_DIV8
SPI_CLOCK_DIV16
SPI_CLOCK_DIV32
SPI_CLOCK_DIV64
SPI_CLOCK_DIV128
*/
void MVSPIClass::setClockDivider(uint8_t rate)
{
SPCR = (SPCR & ~SPI_CLOCK_MASK) | (rate & SPI_CLOCK_MASK);

View File

@@ -110,11 +110,13 @@ public:
MicroView(void) {};
void begin(void);
#if ARDUINO >= 100
//#if ARDUINO >= 100
virtual size_t write(uint8_t);
#else
virtual void write(uint8_t);
#endif
//#else
// virtual void write(uint8_t);
//#endif
// RAW LCD functions
void command(uint8_t c);
@@ -202,7 +204,9 @@ public:
void setMaxValue(int16_t max);
void setMinValue(int16_t max);
void setValue(int16_t val);
virtual void draw(){};
/** \brief Draw widget value overridden by child class. */
virtual void draw(){};
/** \brief Draw widget face overridden by child class. */
virtual void drawFace(){};
private:
@@ -257,6 +261,7 @@ private:
class MVSPIClass {
public:
/** \brief Transfer data byte via SPI port. */
inline static byte transfer(byte _data);
// SPI Configuration methods
@@ -291,4 +296,4 @@ void MVSPIClass::detachInterrupt() {
extern MicroView uView;
#endif
#endif

View File

@@ -25,12 +25,12 @@ Arduino library for MicroView.
#include &lt;MicroView.h&gt;
void setup() {
uView.begin();
uView.begin();
}
void loop() {
uView.print("HelloWorld");
uView.display(); // display current page buffer
uView.print("HelloWorld");
uView.display(); // display current page buffer
}
</code></pre>
@@ -39,18 +39,18 @@ void loop() {
#include &lt;MicroView.h&gt;
void setup() {
uView.begin();
uView.clear(PAGE); // clear the page buffer
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
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
}
</code></pre>
@@ -61,18 +61,18 @@ void loop() {
MicroViewWidget *widget,*widget2;
void setup() {
uView.begin();
uView.clear(PAGE);
widget= new MicroViewGauge(32,30,0,100); // draw Gauge widget at x=32,y=30,min=0, max=100
widget2= new MicroViewSlider(0,0,0,100); // draw Slider widget at x=0,y=0,min=0, max=100
uView.begin();
uView.clear(PAGE);
widget= new MicroViewGauge(32,30,0,100); // draw Gauge widget at x=32,y=30,min=0, max=100
widget2= new MicroViewSlider(0,0,0,100); // draw Slider widget at x=0,y=0,min=0, max=100
}
void loop() {
for(int i=0; i&lt;=100;i++) {
widget->setValue(i); // give a value to widget
widget2->setValue(i);
uView.display(); // display current page buffer
}
for(int i=0; i&lt;=100;i++) {
widget->setValue(i); // give a value to widget
widget2->setValue(i);
uView.display(); // display current page buffer
}
}
</code></pre>
@@ -81,16 +81,23 @@ void loop() {
#include &lt;MicroView.h&gt;
void setup() {
uView.begin();
uView.clear(PAGE);
uView.begin();
uView.clear(PAGE);
}
void loop() {
uView.checkComm();
uView.checkComm();
}
</code></pre>
## History
**v1.14b: 26th July 2014 by JP Liew
* added Learning Kit Circuit Sketch
**v1.13b: 13th June 2014 by JP Liew**
* added Sine Wave Example
* inserted license to example code
**v1.12b: 11th June 2014 by JP Liew**
* added comments for SparkFun Logo
* added Rotating Cube example by Jim Lindblom @ SparkFun Electronics
@@ -165,4 +172,4 @@ void loop() {
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.

View File

@@ -0,0 +1,24 @@
#include <MicroView.h>
/*
MicroView Blink
Draw a circle for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
uView.begin();
uView.clear(PAGE);
}
// the loop routine runs over and over again forever:
void loop() {
uView.circleFill(32,24,10,WHITE,NORM);
uView.display();
delay(1000); // wait for a second
uView.circleFill(32,24,10,BLACK,NORM);
uView.display();
delay(1000); // wait for a second
}

View File

@@ -0,0 +1,14 @@
int LED = A3; // declare LED as pin A3 of MicroView
void setup()
{
pinMode(LED, OUTPUT); // set LED pin as OUTPUT
}
void loop()
{
digitalWrite(LED, HIGH); // set LED pin HIGH voltage, LED will be on
delay(1000); // delay 1000 ms
digitalWrite(LED, LOW); // set LED pin LOW voltage, LED will be off
delay(1000); // delay 1000 ms
}

View File

@@ -0,0 +1,23 @@
#include <MicroView.h> // include MicroView library
int relayPin = 2; // set relayPin as pin 2 of Arduino
void setup() {
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
pinMode(relayPin, OUTPUT); // initialize the digital pin as an output.
}
void loop() {
uView.setCursor(0,0); // set cursor at 0,0
uView.print("YELLOW"); // print YELLOW text
uView.display(); // display
digitalWrite(relayPin, HIGH); // turn the RELAY ON (HIGH is the voltage level)
delay(1000); // wait for a second
uView.setCursor(0,0);
uView.print("RED ");
uView.display();
digitalWrite(relayPin, LOW); // turn the RELAY off by making the voltage LOW
delay(1000); // wait for a second
}

View File

@@ -0,0 +1,20 @@
#include <MicroView.h> // include MicroView library
MicroViewWidget *widget; // declare widget pointer
int sensorValue; // declare variable to store sensor value
int sensorPin=A0; // declare sensor pin as A0 of Arduino
void setup() {
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
widget = new MicroViewSlider(0,0,0,1024, WIDGETSTYLE1); // declare widget as slider
pinMode(sensorPin, INPUT); // set sensor pin as INPUT
}
void loop () {
sensorValue=analogRead(sensorPin); // read and store sensor value
widget->setValue(sensorValue); // set sensor value to widget
uView.display(); // display widget
delay(20); // delay 20 ms
}

View File

@@ -0,0 +1,26 @@
#include <MicroView.h> // include MicroView library
MicroViewWidget *widget; // create widget pointer
MicroViewWidget *widget2; // create widget pointer
int sensorPin = A1; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
void setup()
{
digitalWrite(sensorPin, HIGH); // Internal Pull-up
pinMode(sensorPin, INPUT); // make pin as INPUT
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
widget = new MicroViewSlider(0, 0, 0, 1024); // make widget as Slider
widget2 = new MicroViewSlider(0, 20, 0, 1024, WIDGETSTYLE1); // make widget as Silder STYLE1
uView.display(); // display the content in the screen buffer
}
void loop()
{
sensorValue = analogRead(sensorPin); // read sensorPin
widget->setValue(sensorValue); // set value of sensorPin to widget
widget2->setValue(sensorValue); // set value of sensorPin to widget
uView.display(); // display the content in the screen buffer
}

View File

@@ -0,0 +1,71 @@
#include <MicroView.h> // include MicroView library
MicroViewWidget *redWidget, *greenWidget, *blueWidget; // declare 3 widget pointers
int RED = 6; // declare RED LED pin 6
int GREEN = 5; // declare GREEN LED pin 5
int BLUE = 3; // declare BLUE LED pin 3
int fadeStep = 10; // declare fading steps
int dly=20; // declare delay
void setup()
{
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
redWidget = new MicroViewSlider(0,0,0,255); // declare RED widget as slider
greenWidget = new MicroViewSlider(0,10,0,255); // declare GREEN widget as slider
blueWidget = new MicroViewSlider(0,20,0,255); // declare BLUE widget as slider
pinMode(RED, OUTPUT); // set RED LED pin as OUTPUT
pinMode(GREEN, OUTPUT); // set GREEN LED pin as OUTPUT
pinMode(BLUE, OUTPUT); // set BLUE LED pin as OUTPUT
}
void loop()
{
int i; // init i variable for general use
// brightening
for (i=0;i<=255;i+=fadeStep) { // step i from 0 to 255 by fadeSteps
redWidget->setValue(i); // set brightness value for RED LED to widget
uView.display(); // display the content of the screen buffer
analogWrite(RED,i); // set brightness value for RED LED to the pin
delay(dly);
}
// dimming
for (i=255;i>=0;i-=fadeStep) { // step i from 255 to 0 by fadeSteps
redWidget->setValue(i);
uView.display();
analogWrite(RED,i);
delay(dly);
}
// brightening
for (i=0;i<=255;i+=fadeStep) {
greenWidget->setValue(i);
uView.display();
analogWrite(GREEN,i);
delay(dly);
}
// dimming
for (i=255;i>=0;i-=fadeStep) {
greenWidget->setValue(i);
uView.display();
analogWrite(GREEN,i);
delay(dly);
}
// brightening
for (i=0;i<256;i+=fadeStep) {
blueWidget->setValue(i);
uView.display();
analogWrite(BLUE,i);
delay(dly);
}
// dimming
for (i=255;i>=0;i-=fadeStep) {
blueWidget->setValue(i);
uView.display();
analogWrite(BLUE,i);
delay(dly);
}
}

View File

@@ -0,0 +1,29 @@
#include <MicroView.h> // include MicroView library
int buttonPin = A0; // push button pin
int buttonState = 0; // variable to store the pushbutton status
void setup() {
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input
digitalWrite(buttonPin,HIGH); // set Internal pull-up
}
void loop() {
buttonState = digitalRead(buttonPin); // read the state of the pushbutton value
// check if the pushbutton is pressed.
// if it is not pressed, the buttonState is HIGH:
if (buttonState == HIGH) {
uView.setCursor(0,0); // set cursor at 0,0
uView.print("OFF"); // print OFF
uView.display();
}
else {
uView.setCursor(0,0);
uView.print("ON ");
uView.display();
}
}

View File

@@ -0,0 +1,20 @@
#include <MicroView.h> // include MicroView library
MicroViewWidget *widget; // declare widget pointer
int sensorPin = A2; // select the input pin for the photo resistor
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
pinMode(sensorPin,INPUT); // set sensor pin as INPUT
digitalWrite(sensorPin,HIGH); // set Internal pull-up
uView.begin(); // start MicrView
uView.clear(PAGE); // clear page
widget = new MicroViewGauge(32,24,0,1023,WIDGETSTYLE1); // set widget as gauge STYLE1
}
void loop() {
sensorValue= analogRead(sensorPin); // read value from sensorPin
widget->setValue(sensorValue); // set the sensorValue to the gauge widget
uView.display(); // display the widget
}

View File

@@ -0,0 +1,23 @@
#include <MicroView.h> // include MicroView library
MicroViewWidget *widget; // declare widget pointer
int sensorPin = A0; // select the input pin for the temperature sensor
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
pinMode(sensorPin,INPUT); // set sensor pin as INPUT
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
widget = new MicroViewGauge(32,24,0,255,WIDGETSTYLE1); // declare as gauge widget
uView.drawChar(47,33,67); // Character C is ASCII code 67
}
void loop() {
sensorValue= analogRead(sensorPin); // read sensor pin value
float voltage = sensorValue * 5.0; // voltage at pin in volt
voltage /= 1024.0; // voltage = sensorValue x (5/1024)
float temperatureC = (voltage - 0.5) * 100 ; // C = (voltage - 0.5) x 100
widget->setValue(temperatureC); // set temperature value to the gauge
uView.display(); // display gauge tick
}

View File

@@ -0,0 +1,38 @@
#include <MicroView.h> // include MicroView library
#include <Servo.h> // include Servo library
Servo servo; // declare servo object
void setup()
{
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
servo.attach(6); // servo control pin at D6
}
void loop()
{
uView.setCursor(0,0); // set cursor to 0,0
uView.print("Mid "); // display Mid
uView.display();
servo.write(90); // about 90 degree
delay(2000); // delay 2 seconds
uView.setCursor(0,0);
uView.print("Left ");
uView.display();
servo.write(20); // about 20 degree
delay(2000);
uView.setCursor(0,0);
uView.print("Mid ");
uView.display();
servo.write(90); // about 90 degree
delay(2000);
uView.setCursor(0,0);
uView.print("Right");
uView.display();
servo.write(160); // about 160 degree
delay(2000);
}

View File

@@ -0,0 +1,82 @@
#include <MicroView.h>
// adapted from SparkFun Inventor Kit https://www.sparkfun.com/products/12001
// Please download the original source code for detail comment of the source code
// http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Kits/SIK%20Guide%20Code.zip
const int buzzerPin = A0;
const int songLength = 18;
char notes[] = "cdfda ag cdfdg gf "; // a space represents a rest
int beats[] = {1,1,1,1,1,1,4,4,2,1,1,1,1,1,1,4,4,2};
int tempo = 150;
void setup()
{
uView.begin();
uView.clear(PAGE);
pinMode(buzzerPin, OUTPUT);
}
void loop()
{
int i, duration;
for (i = 0; i < songLength; i++) // step through the song arrays
{
duration = beats[i] * tempo; // length of note/rest in ms
if (notes[i] == ' ') // is this a rest?
{
uView.print(" ");
uView.display();
delay(duration); // then pause for a moment
}
else // otherwise, play the note
{
uView.print(notes[i]);
uView.display();
tone(buzzerPin, frequency(notes[i]), duration);
delay(duration); // wait for tone to finish
}
delay(tempo/10); // brief pause between notes
}
// We only want to play the song once, so we'll pause forever:
while(true){}
// If you'd like your song to play over and over,
// remove the above statement
}
int frequency(char note)
{
// This function takes a note character (a-g), and returns the
// corresponding frequency in Hz for the tone() function.
int i;
const int numNotes = 8; // number of notes we're storing
// The following arrays hold the note characters and their
// corresponding frequencies. The last "C" note is uppercase
// to separate it from the first lowercase "c". If you want to
// add more notes, you'll need to use unique characters.
// For the "char" (character) type, we put single characters
// in single quotes.
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
int frequencies[] = {262, 294, 330, 349, 392, 440, 494, 523};
// Now we'll search through the letters in the array, and if
// we find it, we'll return the frequency for that note.
for (i = 0; i < numNotes; i++) // Step through the notes
{
if (names[i] == note) // Is this the one?
{
return(frequencies[i]); // Yes! Return the frequency
}
}
return(0); // We looked through everything and didn't find it,
// but we still need to return a value, so return 0.
}

View File

@@ -0,0 +1,54 @@
#include <MicroView.h> // include MicroView library
int motorPIN = 3; // set motor control pin
MicroViewWidget *widget; // declare widget pointer
void setup() {
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
pinMode(motorPIN, OUTPUT); // initialize the digital pin as an output.
widget = new MicroViewGauge(32,24,90,255,WIDGETSTYLE1); // set widget as gauge STYLE1
setPwmFrequency(motorPIN,1); // set PWM frequency to about 31K
}
void loop() {
for (int i=90;i<255;i+=10) { // step i from 90 to 255 by step of 10
widget->setValue(i); // set i value to gauge
uView.display(); // display gauge
analogWrite(motorPIN, i); // set the DUTY cycle of the motorPIN
delay(500); // delay 500 ms
}
}
// function to set the frequency of the PWM pin
// adapted from http://playground.arduino.cc/Code/PwmFrequency
void setPwmFrequency(int pin, int divisor) {
byte mode;
if(pin == 5 || pin == 6 || pin == 9 || pin == 10) {
switch(divisor) {
case 1: mode = 0x01; break;
case 8: mode = 0x02; break;
case 64: mode = 0x03; break;
case 256: mode = 0x04; break;
case 1024: mode = 0x05; break;
default: return;
}
if(pin == 5 || pin == 6) {
TCCR0B = TCCR0B & 0b11111000 | mode;
} else {
TCCR1B = TCCR1B & 0b11111000 | mode;
}
} else if(pin == 3 || pin == 11) {
switch(divisor) {
case 1: mode = 0x01; break;
case 8: mode = 0x02; break;
case 32: mode = 0x03; break;
case 64: mode = 0x04; break;
case 128: mode = 0x05; break;
case 256: mode = 0x06; break;
case 1024: mode = 0x7; break;
default: return;
}
TCCR2B = TCCR2B & 0b11111000 | mode;
}
}

View File

@@ -0,0 +1,10 @@
#include <MicroView.h>
void setup() {
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
uView.print("HelloWorld"); // display HelloWorld
uView.display();
}
void loop () {}

View File

@@ -1,3 +1,20 @@
/*
MicroView Arduino Library
Copyright (C) 2014 GeekAmmo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <MicroView.h>
#include <Time.h>

View File

@@ -0,0 +1,60 @@
/*
MicroView Sine Wave Example
Copyright (C) 2014 GeekAmmo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <MicroView.h>
void setup() {
uView.begin();
uView.clear(PAGE);
}
void loop () {
int i;
float rad,srad, x,y;
int amp=20;
int nPhase=360;
for(i=0; i<nPhase;i++) {
x=i;
x=x*0.017453;
y= sin(x);
y=y*amp; // amplitude
y=y+24;
x=(double)64/(double)nPhase;
x=x*i;
uView.pixel(x, y);
uView.display();
}
amp=10;
nPhase=3*360;
for(i=0; i<nPhase;i++) {
x=i;
x=x*0.017453;
y= cos(x);
y=y*amp; // amplitude
y=y+24;
x=(double)64/(double)nPhase;
x=x*i;
uView.pixel(x, y);
}
uView.display();
delay(1500);
uView.clear(PAGE);
}

View File

@@ -1,3 +1,20 @@
/*
MicroView Arduino Library
Copyright (C) 2014 GeekAmmo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <MicroView.h>
MicroViewWidget *widget[4]; // declaring an array of 4 MicroViewWidget