Quantcast
Channel: Tópicos
Viewing all articles
Browse latest Browse all 11336

Criar movimento suave com bitshift operators

$
0
0
seuqram, amanhã respondo-te. Para já deixo aqui outra versão para o que eu acho que o HappyHippyHippo me pediu. #include <stdio.h> #include <time.h> //<-- inserted line void CreatePrintCustomChar(uint8_t memOffset, byte* customChar){ //<-- changed line for(uint8_t i = 0; i < 8; i++) customChar[i] = rand() % 32; lcd.createChar(memOffset, customChar); lcd.write(memOffset, customChar); } int main(void){ uint8_t memOffset = 0, dir = 1; byte customChar[8] = {0}; srand(time(NULL)); lcd.setCursor(0, 0); for(uint8_t i = 0; i < 80; i++){ CreatePrintCustomChar(memOffset, customChar0); if(memOffset < 7 && dir) memOffset++; else if(memOffset > 1 && !dir) memOffset--; else dir ^= 1; } return 0; } Isto apenas impreime um customChar, mas depois é só repetir 80 vezes para encher o LCD e deixar o apontador interno avançar naturalmente Edit; Entretanto corrigi o código e penso que assim já teremos o LCD todo preenchido com caractéres aleatórios para testar quanto tempo leva o LCD a criar e a imprimir os 80 caractéres!

Viewing all articles
Browse latest Browse all 11336

Latest Images

Trending Articles



Latest Images