- Thu Mar 05, 2015 4:53 pm
#180246
And here's my first little sketch: take a squiggly line made up of 500 randomly placed dots - wait two seconds, clear the screen and do it again . . .
I am not very good at writing code so apologies up front for doing stuff wrong and without any sense of organization or thought of efficiency . . .
I am not very good at writing code so apologies up front for doing stuff wrong and without any sense of organization or thought of efficiency . . .
Code: Select all
#include <MicroView.h>
int xLoc = 32;
int yLoc = 24;
int counter = 0;
void setup() {
uView.begin(); // start MicroView
uView.clear(PAGE); // clear page
uView.display();
uView.clear(PAGE); // clear page
}
void loop()
{
uView.pixel(xLoc,yLoc);
uView.display(); // display current page buffer
delay(12);
xLoc = xLoc + random(-1,2);
yLoc = yLoc + random(-1,2);
counter ++;
if (counter > 500) {
delay(2000);
uView.clear(PAGE);
counter = 0;
}
if (xLoc < 1) {
xLoc = 1;
}
if (xLoc > 62) {
xLoc = 62;
}
if (yLoc < 1) {
yLoc = 1;
}
if (yLoc > 46) {
yLoc = 46;
}
}
It's not perfection I'm seeking but always a job well done. Enjoy doing fun stuff while you can because we all need a healthy balance, to combat all the necessary serious stuff.