Open BretterBote opened 12 months ago
Hi, I'd also like to use the 2"13 in horizontal / landscape mode. I did set the rotation _paint.SetRotate(ROTATE90); and swapped height/width in Paint paint(image, 64, 128); The text "e-Paper Demo" ist displayed horizontally :-) but shorted to "e-Paper" and display twice, one below the other. The text "Hello" is not displayed. I commented out the grafical parts (circles, lines, squares and image) as I only need text. Has epd.Display(image); really to be executed 8 times ?!
I really need some help here. Can't be that difficult to display text horizontally, just can't find any example or documentation.In the End I wouldlike to display 3 or four digits (0...9) in full heigt. So far, I couldn't find any font larger thant 24. But that's another problem ;-)
Here's the slightly modified code (based on epd2in13b_V4, using an AtMega328PB):
`#include <SPI.h>
#include "epd2in13b_V4.h"
//#include "imagedata.h"
#include "epdpaint.h"
#define COLORED 0
#define UNCOLORED 1
unsigned char image[4000 / 4 + 50];
void setup() {
// put your setup code here, to run once:
Serial.begin(19200);
Epd epd;
if (epd.Init() != 0) {
Serial.print("e-Paper init failed");
return;
}
/* This clears the SRAM of the e-paper display */
epd.ClearFrame();
/**
Due to RAM not enough in Arduino UNO, a frame buffer is not allowed.
In this case, a smaller image buffer is allocated and you have to
update a partial display several times.
1 byte = 8 pixels, therefore you have to set 8*N pixels at a time.
*/
//Paint paint(image, 128, 63); //width should be the multiple of 8
Paint paint(image, 64, 128); //swapped height and width for horizontal mode, width should be the multiple of 8
paint.Clear(UNCOLORED);
Serial.print("Rotation is: ");
Serial.println (paint.GetRotate());
paint.SetRotate(ROTATE_90);
Serial.print("Rotation is now: ");
Serial.println (paint.GetRotate());
paint.DrawStringAt(8, 25, "e-Paper Demo", &Font24, COLORED);
epd.Display(image);//1
paint.Clear(UNCOLORED);
// paint.DrawRectangle(2, 2, 50, 50, COLORED);
// paint.DrawLine(2, 2, 50, 50, COLORED);
// paint.DrawLine(2, 50, 50, 2, COLORED);
epd.Display(image);//2
//paint.Clear(UNCOLORED);
// paint.DrawCircle(25, 25, 20, COLORED);
epd.Display(image);//3
paint.Clear(UNCOLORED);
epd.Display(image);//4
paint.Clear(UNCOLORED);
paint.DrawStringAt(8, 80, "Hello", &Font12, COLORED);
epd.Display(image);//5
// paint.Clear(UNCOLORED);
// paint.DrawFilledRectangle(52, 2, 100, 50, COLORED);
// paint.DrawLine(52, 2, 100, 50, UNCOLORED);
// paint.DrawLine(100, 2, 52, 50, UNCOLORED);
epd.Display(image);//6
//paint.Clear(UNCOLORED);
//paint.DrawFilledCircle(75, 25, 20, COLORED);
epd.Display(image);//7
//paint.Clear(UNCOLORED);
epd.Display(image);//8
delay(2000);
/* This displays an image */
//epd.DisplayFrame(gImage_2in13b_V4b, gImage_2in13b_V4r);
/* Deep sleep */
epd.Sleep();
}
void loop() {
// put your main code here, to run repeatedly:
}`
Using an Arduino Uno R3 with the new demo code for the 2.13 V4 eink display. I would like to use it in landscape not portrait. How can i manipulate the frame_buffer? paint.SetRotate doesnt quite help as it seems like its still in portrait mode.