Hallo Zusammen
ich bin gerade dabei ein Oled mit einem Attiny85 anzusteuern.
Mit einem UNO klappts doch leider ist der Sketch für den Attiny85 zu groß.
Fehlermeldung:c:/users/rudi/appdata/local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld.exe: C:\Users\Rudi\AppData\Local\Temp\arduino\sketches\6B65073F2AD990313CE486A0BD9F2F5A/Oehldruck_5_Attiny85.ino.elf section .text' will not fit in region text'
c:/users/rudi/appdata/local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld.exe: region `text' overflowed by 6696 bytes
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
der Sketch:
#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Res = 12
// For OLED display with SH1106 driver. If you use another display,
// then please check the u8glib documentation and website at
// https://github.com/olikraus/u8glib
int Zeigerwinkel=0;
int p, w, m,a=10;
u8g_uint_t xx=0;
// ------------------------------------------------- void gauge() ------------------------------------------
void gauge(uint8_t Zeigerwinkel) {
// der Bogen des Messgeräts
u8g.drawCircle(64,41,31+6, U8G_DRAW_UPPER_RIGHT);
u8g.drawCircle(64,41,31+6, U8G_DRAW_UPPER_LEFT);
// den Zeiger zeichnen
float x1=sin(2*Zeigerwinkel*2*3.14/360); //errechnete Position der Zeigerspitze
float y1=cos(2*Zeigerwinkel*2*3.14/360); //errechnete Position der Zeigerspitze
u8g.drawLine(64, 41, 64+31*x1, 41-31*y1); //der Zeiger wird dargestellt
u8g.drawDisc(64, 41, 5, U8G_DRAW_UPPER_LEFT);
u8g.drawDisc(64, 41, 5, U8G_DRAW_UPPER_RIGHT);
u8g.setFont(u8g_font_chikita);
// Skalenbeschriftung anzeigen
u8g.drawStr( 20, 42, "0"); //Beschriftung bei 0%
u8g.drawStr( 25, 18, "1,8");//Beschriftung bei 25%
u8g.drawStr( 60, 14, "3,5"); //Beschriftung bei 50%
u8g.drawStr( 95, 18, "5,25"); //Beschriftung bei 75%
u8g.drawStr( 105, 42, "7,0");//Beschriftung bei 100%
// Messwert Beschriftung
u8g.setPrintPos(45,32); //Position der Beschriftung X,Y
u8g.print("Oehldruck"); //hier wird die Beschriftung des Messwertes festgelegt Anzeige des Digitalisierten Messwertes
u8g.setFont(u8g_font_profont22);
u8g.setPrintPos(54,60);
if (w<10){ // 0 wird vorangestellt wenn der Messwert kleiner 10 ist
u8g.print("0");
}
if (w>99) { // position at 100%
u8g.setPrintPos(47,60);
}
u8g.print(w);
u8g.setPrintPos(85,60); //Position der Beschriftung X,Y
u8g.print("bar");
}
// ------------------------------------------------- void setup() ------------------------------------------
void setup(void) {
u8g.setFont(u8g_font_chikita);
u8g.setColorIndex(1); // Instructs the display to draw with a pixel on.
// 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);
}
}
// ------------------------------------------------- void loop() ------------------------------------------
void loop(void) {
//Der Messwert wird automatisch hoch und dann runtergezaeht
p+=a;
if( p > 1023) a = -10;
else if( p < 0 ) a = 10;
w = map(p,0,1023,0,7); // map it between 0 and 100
m = map(p,0,1023,0,90); // map needle movement
// show needle and dial
xx = m; // 135 = zero position, 180 = just before middle, 0 = middle, 45 = max
if (xx<45){ // positie correctie
xx=xx+135;
}
else {
xx=xx-45;
}
// picture loop
{
u8g.firstPage();
do {
gauge(xx);
}
while( u8g.nextPage() );
}
}
ich habe schon einiges eingespart und den Sketch lade ich ohne Bootloader hoch,doch leider reichts noch nicht. Könnte mir jemand behilflich sei noch etwas Speicher freizuschaufeln.
Oder gibts einen MC der mehr Speicher hat und mechanisch ähnlich groß wie der Digispark Attiny ist.
Vielen Dank Rudi