I'm using a samd21 (m0) qtpy microcontroller for my project. I connected an eink display to the qtpy. I read the data from an array in the Texts.h file. This worked fine on the arduino pro mini, but it has limit memory, that's why I switched to this mcu. Now i'm using the same code and it works all perfectly fine until I close my arduino ide or connect the controller to an external supply. So somehow it is depending on the pc for data... I am sure that the array is uploaded since the sketch size shrinks when I remove some of the lines in the aray.
The main sketch:
#include "Adafruit_ThinkInk.h"
#include "ArduinoLowPower.h"
#include "Texts.h"
#define EPD_CS 6
#define EPD_DC 7
#define SRAM_CS 3
#define EPD_RESET 5 // can set to -1 and share with microcontroller Reset!
#define EPD_BUSY -1 // can set to -1 to not use a pin (will wait a fixed delay)
/* Pinout e-ink to seeed XIAO:
SRCS = 3
BUSY = 4
RST = 5
ECS = 6
DC = 7
MOSI = 11
MISO = 12
SCK = 13
*/
int Randomtext = 0;
int Textentries = sizeof(Texts) / sizeof(Texts[0]);
// 2.13" Monochrome displays with 250x122 pixels and SSD1680 chipset
ThinkInk_213_Mono_BN display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
void setup() {
Serial.begin(115200);
while (!Serial) {
delay(10);
}
display.begin(THINKINK_MONO);
pinMode(EPD_RESET, OUTPUT);
digitalWrite(EPD_RESET, HIGH);
}
void loop() {
display.clearBuffer();
display.setTextSize(2);
testdrawtext(Texts[Randomtext = random(0, sizeof(Texts) / sizeof(Texts[0]))], EPD_BLACK); // pick a random text somewhere between 0 and the size of the Texts array
Serial.print(Randomtext);
Serial.print(F("Printing text: "));
Serial.println(Texts[Randomtext]);
display.display();
LowPower.sleep(8000);
}
void testdrawtext(const char *text, uint16_t color) {
display.setCursor(0, 0);
display.setTextColor(color);
display.setTextWrap(true);
display.print(text);
}
small part of the .h file:
const char *Texts[] =
{
// Compliments/personal development
"You look beautifull today!",
"Today is the day",
"Nobody is perfect, but you're so close it's scary",
"Your voice is my favorite sound",
};
Any idea why the mcu is dependent on the ide's data?