Winking Microview

With my travel and work schedules, I haven’t had time to hack my original MicroView, but the replacement ones arrived while I was out at ABQ Mini Maker Faire! So of course, I had to try *something* now that I can actually flash things to it.

Here’s my current very simple program: a smile with a wink!

microview_wink

Although it’s probably better with video

And of course, it’s more fun if you can also check out the code so I dumped it into my git repository. Here it is in case you’re not feeling like clicking through:

/* 
 * microview_wink: a simple winking face animation for the MicroView
 * 
 * Created by: Terri Oda 
 * Sept 16, 2014
 */

#include 

void setup() {
  uView.begin();		// start MicroView
  uView.clear(PAGE);		// clear page
  uView.print("Hi Terri!");	// say hi
  uView.display();
  delay(1000);
}

void loop () {
  //drawFace();
  winkFaceAnimation();
}

void drawFace() { 
  uView.clear(PAGE);
  
  drawEyes();
  drawNose();
  drawMouth();    

  uView.display();        // display current page buffer
}

void drawEyes() {
  uView.circle(20, 15, 5);
  uView.circle(45, 15, 5);
}

void drawNose() {
  uView.line(30, 22, 35, 32);
  uView.line(35, 32, 31, 32);
}

void drawMouth() {
  uView.line(20, 40, 25, 45);
  uView.line(25, 45, 40, 45);
  uView.line(40, 45, 45, 40);
}

void winkFaceAnimation() {
  for (int i = 0; i < 7; i++) {
    uView.clear(PAGE);
    
    // animate one eye for the wink
    switch (i) {
      case 0: 
      case 6:
        uView.circle(45, 15, 5);
        break;
      case 1:
      case 5: 
        uView.rect(40, 12, 10, 5);
        break;
      case 2:
      case 4:
        uView.rect(40, 14, 10, 2);
        break;
      case 3: 
        uView.line(40, 15, 50, 15);
        break;
    }

    // draw the static parts of the face
    uView.circle(20, 15, 5);    
    drawNose();
    drawMouth();
    
    // display and wait for the next frame to start
    uView.display();
    delay(500);
  }  
}

The MicroView was pretty easy to get up and running since this machine was already set up for arduino programming, I just had to remember to switch from the Adafruit Flora (what I'd been coding for last) to the Microview ( / the Arduino Uno). I'm pretty pleased with my first run, and even though I am reminded that animation frame drawing is not my favourite activity, I'm happy to have written some code for it, even if it's absurdly simple.

I'm still planning on continuing with the necklace plan for the first of these, so I'm going to work on a few more animations while I decide how I'm going to handle power, shaping, and whether I'm going to want any sensors in the final pendant. My current plan is that I'll create a backpiece that I can embed a battery into (probably 3d printed?), and I think I'd like to stick an accelerometer in there so it can be more interactive. But my plans may change as I fiddle with it!