This was the “Hello world” sketch that I wrote to start playing with MicroView. I tweeted a short youtube video https://www.youtube.com/watch?v=vpmuiTHIEOA and somebody asked for the code. I do not even know if text scrolling is supported “natively” by the MicroView library. Just in case it is useful for someone else, I have decided to post the code here.
#include <MicroView.h>
// MicroView scrolling sketch
// Written by @tumaku_ 2014
int mStartPosition=63;
int mCharWidth=0;
uint8_t mString [] ={'H','o','l','a',' ','m','u','n','d','o','!','!','!'};
int mStringSize=13;
void setup() {
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
uView.setFontType(1);
mCharWidth=uView.getFontWidth();
delay(1000);
}
void loop () {
uView.clear(PAGE);
for (int j=0; j<mStringSize; j++){
drawChar(mStartPosition+mCharWidth*j,18,mString[j]);
}
mStartPosition--;
uView.display();
delay(20);
if (mStartPosition<-mStringSize*mCharWidth) mStartPosition=63;
}
void drawChar(int x, int y, uint8_t value) {
if ((x+ mCharWidth>0)&&(x<64)) uView.drawChar(x,y,value);
}