I'm trying to send some data to a 4.2 inch e-Paper module. I can't get it to work properly. I'm using the e-Paper library (GitHub - waveshare/e-Paper). I already programmed this:
#include <SPI.h>
#include <mcp_can.h>
#include "epd4in2b_V2.h"
#include "imagedata.h"
#include "epdpaint.h"
#define COLORED 0
#define UNCOLORED 1
Epd epd;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
if (epd.Init() != 0) {
Serial.print("e-Paper init failed");
return;
}
}
void loop()
{
Serial.print("begin loop");
unsigned char image [1500];
Paint paint(image, 400, 28);
Epd epd;
epd.ClearFrame();
int minvolt = 147;
String een = String(minvolt) + "milliVolts";
char const *voltmin = een.c_str();
int maxvolt = 245;
String twee = String(maxvolt) + "milliVolts";
char const *voltmax = twee.c_str();
int gemvolt = 197;
String drie = String(gemvolt) + "milliVolts";
char const *voltgem = drie.c_str();
paint.Clear(UNCOLORED);
paint.DrawStringAt(7, 0, voltmin, &Font16, COLORED);
epd.SetPartialWindowBlack(paint.GetImage(), 0, 60, paint.GetWidth(), paint.GetHeight());
paint.Clear(UNCOLORED);
paint.DrawStringAt(7, 0, voltmax, &Font16, COLORED);
epd.SetPartialWindowBlack(paint.GetImage(), 0, 100, paint.GetWidth(), paint.GetHeight());
paint.Clear(UNCOLORED);
paint.DrawStringAt(7, 0, voltgem, &Font16, COLORED);
epd.SetPartialWindowBlack(paint.GetImage(), 0, 140, paint.GetWidth(), paint.GetHeight());
epd.DisplayFrame();
epd.Sleep();
delay(1000);
}
If I send this code to the Arduino Uno nothing shows up on the screen. If I send the code like this (without the milivolts) it however does work:
int gemvolt = 197;
String drie = String(gemvolt);
char const *voltgem = drie.c_str();
Anyone able to help me out?