Hello!
I'm trying to format strings on screen and I am having some trouble. I want to be able to write to the screen and have it auto new line when the text goes off the end. I also want to provide the position of the text. printf() allows me to auto new line, and drawString() helps me pick where I want to draw. I can't seem to figure out how to do both. I've tried to use both setTextWrap() and setTextArea(), but these don't seem to work as I expected.
T
Posts made by tamoorh
-
setTextWrap() and setTextArea() not working as expected, how auto new line and choose where to print text?
-
RE: Can't access M5 Paper touch screen in Arduino IDE.
@felmue Thank you so much for the response! This fixed it!
Is this an error with only the Arduino IDE? Or are there other edits that have to be made if I used platformIO? -
Can't access M5 Paper touch screen in Arduino IDE.
Hello,
I'm trying to access the M5Paper touch screen though the arduino IDE, but it does not seem to be working.
I've modified the example code:#include <M5EPD.h> M5EPD_Canvas canvas(&M5.EPD); int point[2][2]; void setup() { M5.begin(); M5.EPD.SetRotation(90); M5.TP.SetRotation(90); M5.EPD.Clear(true); canvas.createCanvas(540, 960); canvas.setTextSize(5); canvas.drawString("Touch The Screen!", 20, 400); canvas.pushCanvas(0,0,UPDATE_MODE_DU4); Serial.begin(115200); } void loop() { Serial.println(M5.TP.avaliable()); if(M5.TP.avaliable()){ if(!M5.TP.isFingerUp()){ M5.TP.update(); canvas.fillCanvas(0); bool is_update = false; for(int i=0;i<2; i++){ tp_finger_t FingerItem = M5.TP.readFinger(i); if((point[i][0]!=FingerItem.x)||(point[i][1]!=FingerItem.y)){ is_update = true; point[i][0] = FingerItem.x; point[i][1] = FingerItem.y; canvas.fillRect(FingerItem.x-50, FingerItem.y-50, 100, 100, 15); Serial.printf("Finger ID:%d-->X: %d*C Y: %d Size: %d\r\n", FingerItem.id, FingerItem.x, FingerItem.y , FingerItem.size); } } if(is_update) { canvas.pushCanvas(0,0,UPDATE_MODE_DU4); } } } }
TP.available() seems to always return zero so none of the other code runs. Am I missing something?