Information

int avgTemp = 0;
for(int i = 0; i<16; i++){
avgTemp += analogRead(TEMP_IN);
}
// read averaged analog value of temperature
long tempADU = avgTemp >> 4;
// convert ADU into temperature
// constants could slightly change for different ceramic tip
tempADU -= 1692; // increase this value when temperature is too high and vice versa
tempADU <<= 7;
tempADU /= (-557);
return tempADU;
}
/*
* load actual material profile
*/
void loadMaterial(int id){
profile_t profile;
char text[10];
// load material profile from PROGMEM and assign variables
memcpy_P(&profile, &materials[id], sizeof(profile_t));
setTemperature = profile.temperature;
setMotorSpeed = profile.motorSpeed;
// clear display and show all information
sprintf(text, "%d %%", setMotorSpeed);
ssd1306_clearScreen();
ssd1306_setFixedFont(ssd1306xled_font6x8);
ssd1306_printFixedN(0, 0, profile.materialName, STYLE_NORMAL, FONT_SIZE_2X);
ssd1306_printFixedN(80, 0, text, STYLE_NORMAL, FONT_SIZE_2X);
}
/*
* PID variables and constants for tuning
*/
float Kp=15, Ki=1, Kd=1.0, dT = 0.1, Hz=10;
/*