int main(void) { sys_init(); oled_init(); timer_init(TIMER1); timer_set_ms(TIMER1,16); // Initial parameters uint8_t x = OLED_WIDTH / 2; // x initial position uint8_t y = OLED_HEIGHT / 2; // y initial position uint8_t dx = 1; // x speed uint8_t dy = 1; // y speed oled_clearDisplay(); oled_drawPixel(x,y); oled_render(); timer_start(TIMER1); while(1) { if(oledUpdate) { LED ^= 1; oled_clearDisplay(); move(&x, &y, &dx, &dy); oled_render(); oledUpdate = 0; } } return (0); }
int main(void) { sys_init(); oled_init(); oled_clearDisplay(); oled_prints(35, 4, "Hello world"); // print on center of the screen oled_render(); while(1) { LED ^= 1; __delay_ms(100); } return (0); }
/* * Function:makeHTmeasurements(void) * -------------------- * Function used to run the sequence of measurements: * 1.Read RH * 2.Calculate Humidity value * 3.Get last temperature measurement after RH measurement was done * 4.Calculate temperature value * 5.Update the display with new values. */ void makeHTmeasurements(void) { measureRH(); humidityValue = calculateHumidity(humidityCode); getLastTemp(); temperatureValue = calculateTemperature(temperatureCode); char str[10]; char humm[10]; sprintf(str, "%d", temperatureValue); oled_prints(30, 6, str); sprintf(humm, "%d", humidityValue); oled_prints(45, 8, humm); oled_render(); UART1PutStr(str); }