I’m going to base some code off of @emutyworks’s post and combine it with mine that I just posted.
#include "Arduboy.h"
Arduboy arduboy;
PROGMEM const unsigned char frameone[] =
{
0x00, 0x00, 0x00, 0x80, 0x00, 0x78, 0x78, 0x68,
0x78, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x73, 0x4b, 0x67, 0x14, 0x0c,
0x14, 0x67, 0x4b, 0x70, 0x40, 0x00, 0x00, 0x00,
};
PROGMEM const unsigned char frametwo[] =
{
0x00, 0x00, 0x00, 0x80, 0x00, 0x78, 0x78, 0x68,
0x78, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x73, 0x4b, 0x67, 0x14, 0x0c,
0x14, 0x67, 0x4b, 0x70, 0x40, 0x00, 0x00, 0x00,
};
PROGMEM const unsigned char framethree[] =
{
0x00, 0x00, 0x00, 0x80, 0x00, 0x78, 0x78, 0x68,
0x78, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x73, 0x4b, 0x67, 0x14, 0x0c,
0x14, 0x67, 0x4b, 0x70, 0x40, 0x00, 0x00, 0x00,
};
int counter = 0;
int frame = 0;
void setup() {
arduboy.start();
arduboy.clearDisplay();
arduboy.display();
}
void loop() {
arduboy.clearDisplay();
counter = counter + 1;
if( counter == 3 ) {
counter = 0;
frame = frame + 1;
if( frame == 3 ) {
frame = 0;
}
}
if(frame == 1) {
arduboy.drawBitmap(0, 0, frameone, 16, 16, WHITE);
}
if(frame == 2) {
arduboy.drawBitmap(0, 0, frame two, 16, 16, WHITE);
}
if(frame == 3) {
arduboy.drawBitmap(0, 0, framethree, 16, 16, WHITE);
}
arduboy.display();
}
NOTE: I do not have an Arduboy to test this on, so I cannot be sure it’s correct.
This code should work this way: The loop will loop around and clear the display, then counter will increase. When it gets to 3, it’ll reset to 0 and increase frame. If frame is ever 3, then it’ll reset to 0, too. The second part of the loop is simple… If frame is 1, then output the first frame. If it’s 2, then output the second frame. If it’s 3, then output the third frame.