epd2in13_V3.ino 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include <SPI.h>
  2. #include "epd2in13_V3.h"
  3. #include "epdpaint.h"
  4. #include "imagedata.h"
  5. #define COLORED 0
  6. #define UNCOLORED 1
  7. /**
  8. * Due to RAM not enough in Arduino UNO, a frame buffer is not allowed.
  9. * In this case, a smaller image buffer is allocated and you have to
  10. * update a partial display several times.
  11. * 1 byte = 8 pixels, therefore you have to set 8*N pixels at a time.
  12. */
  13. unsigned char image[1050];
  14. Paint paint(image, 0, 0);
  15. Epd epd;
  16. void setup()
  17. {
  18. // put your setup code here, to run once:
  19. Serial.begin(115200);
  20. Serial.println("epd FULL");
  21. epd.Init(FULL);
  22. epd.Display(IMAGE_DATA);
  23. delay(2000);
  24. Paint paint(image, epd.bufwidth*8, epd.bufheight); //width should be the multiple of 8
  25. paint.Clear(UNCOLORED);
  26. paint.DrawStringAt(8, 2, "e-Paper Demo", &Font12, COLORED);
  27. paint.DrawStringAt(8, 20, "Hello world", &Font12, COLORED);
  28. epd.Display1(image);//1
  29. paint.Clear(UNCOLORED);
  30. paint.DrawRectangle(2,2,50,50,COLORED);
  31. paint.DrawLine(2,2,50,50,COLORED);
  32. paint.DrawLine(2,50,50,2,COLORED);
  33. paint.DrawFilledRectangle(52,2,100,50,COLORED);
  34. paint.DrawLine(52,2,100,50,UNCOLORED);
  35. paint.DrawLine(100,2,52,50,UNCOLORED);
  36. epd.Display1(image);//2
  37. paint.Clear(UNCOLORED);
  38. paint.DrawCircle(25,25,20,COLORED);
  39. paint.DrawFilledCircle(75,25,20,COLORED);
  40. epd.Display1(image);//3
  41. paint.Clear(UNCOLORED);
  42. epd.Display1(image);//4
  43. delay(2000);
  44. // Serial.println("epd PART");
  45. // epd.DisplayPartBaseImage(IMAGE_DATA);
  46. // char i = 0;
  47. // for (i = 0; i < 10; i++) {
  48. // Serial.println("e-Paper PART IMAGE_DATA");
  49. // epd.Init(PART);
  50. // epd.DisplayPart(IMAGE_DATA);
  51. // Serial.println("e-Paper PART Clear");
  52. // epd.Init(PART);
  53. // epd.ClearPart();
  54. // delay(2000);
  55. // }
  56. epd.Init(FULL);
  57. Serial.println("e-Paper clear and sleep");
  58. epd.Clear();
  59. epd.Sleep();
  60. }
  61. void loop()
  62. {
  63. }