Arduino nano 小板子和e-Paper2.13墨水屏连接
手里有一个Arduino nano 小板子和2.13吋 e-Paper墨水屏一个,想在arduino下把两者连接起来,折腾一晚终于成功了。
用的是厂家提供的程序,有了这些很快就能搞明白,咱们不是擅长逆向工程研究码[face]qq:13.gif[/face][face]qq:13.gif[/face]
连接方法:
板子:arduino nano
墨水屏:微雪 e-paper 2.13
接法:
e-Paper Arduino nano
Vcc 5V
GND GND
DIN D11
CLK D13
CS D10
DC D9
RST D8
BUSY D7
程序:
#include <SPI.h>
#include "epd2in13.h"
#include "epdpaint.h"
#include "imagedata.h"
#define COLORED 0
#define UNCOLORED 1
unsigned char image[1024];
Paint paint(image, 0, 0);
Epd epd;
unsigned long time_start_ms;
unsigned long time_now_s;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
if (epd.Init(lut_full_update) != 0) {
Serial.print("e-Paper init failed");
return;
}
epd.ClearFrameMemory(0xFF); // bit set = white, bit reset = black
paint.SetRotate(ROTATE_0);
paint.SetWidth(128); // width should be the multiple of 8
paint.SetHeight(24