Got a Pro Micro (I need USB ability). The SSD1306 library I usually use for my graphics/text on my 128x32 I2C screen is just too big. Eats up far too much programming space.
Been trying to use the U8g2 or the U8glib for a smaller footprint, but I just don't understand how to re-arrange the 'HelloWorld' program to be of use to me.
/*
HelloWorld.pde
"Hello World!" example code.
#include "U8glib.h"
U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.setFont(u8g_font_unifont);
//u8g.setFont(u8g_font_osb21);
u8g.drawStr( 0, 22, "Hello World!");
}
void setup(void) {
// flip screen, if required
// u8g.setRot180();
// set SPI backup if required
//u8g.setHardwareBackup(u8g_backup_avr_spi);
// assign default color value
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
u8g.setColorIndex(255); // white
}
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
u8g.setColorIndex(3); // max intensity
}
else if ( u8g.getMode() == U8G_MODE_BW ) {
u8g.setColorIndex(1); // pixel on
}
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255,255,255);
}
pinMode(8, OUTPUT);
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
// rebuild the picture after some delay
//delay(50);
}
How do I rewrite this to allow me to simply print lines of text as I need it?
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.setFont(u8g_font_unifont);
//u8g.setFont(u8g_font_osb21);
u8g.drawStr( 0, 22, "Hello World!");
}
This seems a lot of code just to print one line of text, and surely I don't need a routine to print every line?
I REALLY wish some of these library's were better explained.
What does the u8g.firstPage(); and u8g.nextPage(); achieve?
Finally, I can program my Pro Micro, then next time around, the Arduino IDE denies all knowledge of it. Using V1.8.8. I have to save, exit the IDE and reload to get access to the Pro Micro.
Reset on the board does not help.
Yes. Still cannot get it to work.
Having to reboot the IDE every time I want to upload is driving me mad. After uploading, the port greys out and you cannot find the IC any longer.
Only rebooting the IDE gets it back.
Been FOREVER trying to get a smaller text library to work on this 128x32 screen.
Usually use the SSD1306 library, but that is just too hefty. Eats up all my programming space (Uses 26% just loading it).
Finally got the U8g2lib.h library to work, but it is still pretty sizeable. It now also throws up a memory warning (77%), before I even start using it.
Is there any way of reducing this footprint/usage?
I need basic graphics ideally (just rectangles etc). I managed to get U8g2lib.h working.
But... I also need an SD library, as I need to store and retrieve text data.
Been trying to find a lightweight SD library, but with no luck.
Cannot seem to re-allocate the SPI pins for SdFat.h. My Pro Micro uses different pins than those in the library, and cannot find how to change them.
However, even when that compiles (but doesn't work), I get a low dynamic memory error (82%) and 72% of used programming space... and I have not written the program yet!
Looks like I will have to jump over to a Teensy 3.2 (which I didn't want to do... expensive and I don't have one)
OK. 3 evenings on this now. It's clearly flogging a dead horse.
Cannot get the serial SPI SD version to work either, and it is too resource hungry (The Pro Micro needs SCLK set to pin 15, MOSI to pin 16 and MISO to pin 14). I cannot seem to get these pins changed.
So I tried re-compling for a Teensy 3.2, and now it throws up errors in the "Keyboard.h" and "Mouse.h" libraries.
Is there no way to change the size of the font, other than loading in a whole new font set that is larger/smaller (which isn't practical due to the amount of memory it uses)?
I cannot see any command, but that severely limits the use of this library unless you have loads of spare memory.