Una buona giornata a tutti,
ho bisogno del vostro aiuto, sto provando "e non ci riesco" a far andare un display oled con un Attiny85,
spiego cosa sto facendo:
Programmo l'Attiny con un Arduino uno "programmato come programmatore" collegamenti controllati più volte, display provato con Arduino uno e funziona,
anche l'Attiny testato su altro progetto e funziona,
per provare il display con Attiny ho scaricato da questo sito
il programma ed le relative librerie,
le librerie sono inserite nella cartella del progetto,
la programmazione va a buon fine, ma il display non mostra niente, come morto,
l'indirizzo I2c l'ho controllato con Arduino scanner,
posto il programma con cui sto provando,
#include "TinyWireM.h"
#include "USI_TWI_Master.h"
#include "SSD1306_minimal.h"
#include <avr/pgmspace.h>
#define DEG "\xa7" "C"
SSD1306_Mini oled;
//byte array of bitmap 5x24px
const unsigned char img_thermometer[] PROGMEM = {
0x00, 0xfe, 0x03, 0xfe, 0x50,
0x00, 0xff, 0x00, 0xff, 0x55,
0x60, 0x9f, 0x80, 0x9f, 0x65,
};
//byte array of bitmap 17x16 px
const unsigned char img_heart_small[] PROGMEM = {
0x00, 0x00, 0xc0, 0xe0, 0xe0, 0xe0, 0xc0, 0x80, 0x80, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00
};
//byte array of bitmap 17x16 px
const unsigned char img_heart_big[] PROGMEM = {
0xe0, 0xf0, 0xf8, 0xf8, 0xf8, 0xf8, 0xf0, 0xe0, 0xe0, 0xe0, 0xf0, 0xf8, 0xf8, 0xf8, 0xf8, 0xf0, 0xe0, 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00
};
//Byte array of bitmap of 76 x 56 px:
const unsigned char img_logo [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x3f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x30, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x07, 0xc3, 0xe3, 0xe3, 0xe3, 0xe3, 0xc3, 0x07, 0x0f, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf0, 0xe1, 0xc3, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xff, 0xff, 0xff, 0xf0, 0xe0, 0xe3, 0xc7, 0xc7, 0xc7, 0xc7, 0xe3, 0xe0, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x8f, 0xc0, 0xc0, 0xf0, 0xff, 0xff, 0xf9, 0xf1, 0x01, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xf1, 0x01, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x01, 0x03, 0xe3, 0xf1, 0xf1, 0xf1, 0xf1, 0x01, 0x03, 0xff, 0xff, 0xff, 0xff, 0x07, 0x03, 0xe1, 0xf1, 0xf1, 0xf1, 0xf1, 0xe1, 0x03, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xe3, 0xe0, 0xe0, 0xe0, 0xe3, 0xe3, 0xf7, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xe3, 0xe0, 0xe0, 0xe0, 0xe3, 0xe3, 0xf7, 0xff, 0xff, 0xf0, 0xe0, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf0, 0xf1, 0xe3, 0xe3, 0xe3, 0xe3, 0xf1, 0xf0, 0xf8, 0xff, 0xff, 0xff, 0xff
};
void splash() {
oled.startScreen();
oled.clear();
oled.drawImage( img_logo, 20, 0, 76, 7 );
oled.cursorTo(0, 7);
oled.printString( "http://CoPiino.cc");
delay(5000);
oled.clear();
oled.cursorTo(15, 1);
oled.printString( "SSD1306+ATTiny");
oled.cursorTo(30, 3);
oled.printString( "Library");
oled.cursorTo(0, 7);
oled.printString( "http://CoPiino.cc");
}
void heartBeat() {
static char big = 1;
static long startTime = 0;
long currentTime;
// get current time
currentTime = millis();
// update if 1000ms passed
if ((currentTime - startTime) > 200) {
startTime = currentTime;
// ---
big = 1 - big;
if (big) {
oled.drawImage( img_heart_big, 10, 5, 17, 2);
} else {
oled.drawImage( img_heart_small, 10, 5, 17, 2);
}
}
}
void prepareDisplay() {
unsigned int i, k;
unsigned char ch[5];
oled.clear();
oled.startScreen();
oled.cursorTo(0, 0);
oled.printString( "ATTiny");
oled.cursorTo(5, 1);
oled.printString( "Standard Font");
oled.cursorTo(10, 2);
oled.printString( "abcdef...xyz");
oled.drawImage( img_thermometer, 50, 4, 5, 3 );
oled.cursorTo(60, 5);
oled.printString( "+15" DEG );
oled.cursorTo(67, 6);
oled.printString( "63%");
oled.drawImage( img_heart_small, 10, 5, 17, 2);
}
char getTemperature() {
return random(-30, 30);
}
char getHumidity() {
return random(0, 99);
}
void setup() {
pinMode(3, INPUT);
oled.init(0x3D);
oled.clear();
delay(1000);
splash();
delay(8000);
prepareDisplay();
}
void loop() {
static long startTime = 0;
long currentTime;
// get current time
currentTime = millis();
// update if 1000ms passed
if ((currentTime - startTime) > 1000) {
startTime = currentTime;
char buf[10];
// ---
// update temperature
char temperature = getTemperature();
sprintf(buf, "%+0.2hd" DEG , temperature);
// set cursor
oled.cursorTo(60, 5);
// print to display
oled.printString( buf );
// ---
// update humidity
char humidity = getHumidity();
sprintf(buf, "%0.2hd\%", humidity);
// set cursor
oled.cursorTo(6, 11);
oled.printString("Antonio");
// print to display
//oled.printString( buf );
}
heartBeat();
}
non riesco a capire dove sbaglio,
chiedo cortesemente un aiuto per risolvere il problema