Skip to content

Instantly share code, notes, and snippets.

@ksasao
Last active August 29, 2015 14:04
Show Gist options
  • Save ksasao/357776ea9840f87142be to your computer and use it in GitHub Desktop.
Save ksasao/357776ea9840f87142be to your computer and use it in GitHub Desktop.
MicroView で動画を表示するためのサンプルコードです。実行結果 https://twitter.com/ksasao/status/492722427005513729 。ソースコ0ード中には動画データは含まれていません。画像データの形式は https://github.com/geekammo/MicroView-Arduino-Library/blob/master/MicroView.cpp 等を参照してください。動画対応するため、プログラム領域 (Flash Memory) にデータを格納しています。ライセンスは WTFPL です。
#include <MicroView.h>
#include <avr/pgmspace.h>
const int IMAGES = 50;
PROGMEM const prog_uchar movie[384*IMAGES] = {
// put image data here...
};
uint8_t buf[384];
int i=0;
void setup()
{
uView.begin();
uView.clear(PAGE);
}
void loop()
{
memcpy_P(buf, movie + i*384, 384); // Flash memory -> SRAM
drawImage(buf);
delay(100);
i = (i+1) % IMAGES;
}
void drawImage(uint8_t *data){
int p = 0;
for (int i=0; i<6; i++) {
uView.setPageAddress(i);
uView.setColumnAddress(0);
for (int j=0;j<0x40;j++) {
uView.data(data[p]);
p++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment