3Dsimo Kit
Device: 3Dsimo Kit
Rev. 1.00 Page 14/18
sprintf (text, "%3d/%3dC", sumTemp, setTemperature);
ssd1306_setFixedFont (ssd1306xled_font6x8);
ssd1306_printFixedN ( 0 , 16 , text, STYLE_NORMAL, FONT_SIZE_2X);
/*
* debug output into display and to serial
*/
/*
sprintf(text, "PID=%03d", valuePID);
ssd1306_printFixed(0, 0, text, STYLE_NORMAL);
sprintf(text, "%3d;%3d", valuePID, sumTemp);
Serial.println(text);
*/
return sumTemp;
}
/*
* call every 50ms timer for buttons action and heating
* execute buttons function according to heating state
* change material profile
*/
void timerAction (){
static int elapsedTime = 0 ;
static char statusHeating = STATE_HEATING;
static char stateMotor = MOTOR_STOP, lastMotorState = MOTOR_STOP;
static int timeMotorReverse = 0 ;
// decide temperature state (heating, cooling, ready) and show it on display
if (++elapsedTime== 2 ){ // 100ms
elapsedTime = 0 ;
int actualTemperature = heating ();
// tolerant zone where temperature is ABOVE preset temperature,
// but it is possible to do extrusion/reverse
if (actualTemperature > setTemperature + 10 ){
statusHeating = STATE_COOLING;
ssd1306_printFixedN ( 116 , 16 , "C", STYLE_NORMAL, FONT_SIZE_2X);
}
// tolerant zone where temperature is OK for extrusion/reverse
else if (actualTemperature > setTemperature - 10 ){
statusHeating = STATE_READY;
ssd1306_printFixedN ( 116 , 16 , "R", STYLE_NORMAL, FONT_SIZE_2X);
digitalWrite (LED_NANO, HIGH); // turn the LED on (HIGH is the voltage level)
}