#include #include const int DataPin = 8; const int IRQpin = 5; PS2Keyboard keyboard; #define w 1024 #define h 675 #define P "(with PS2Keyboard lib, v2.4)" #define S "Sierpinski triangle" #define T "1024 x 675 DueVGA lib" int x,y,state; long last; void setup() { unsigned char L[2][h]; int n,k,o=0; //keyboard.begin(DataPin, IRQpin, PS2Keymap_US); keyboard.begin(DataPin, IRQpin, PS2Keymap_German); //keyboard.begin(DataPin, IRQpin, PS2Keymap_French); x=y=0; VGA.begin(w,h); for(n=0; n 0) { char s[]=" "; if (state) drawCursor32(x,y,state); x-=32; drawText32(s,x,y); } } else if (c == PS2_LEFTARROW) { if (x > 0) { if (state) drawCursor32(x,y,state); x-=32; } } else if (c == PS2_RIGHTARROW) { if (x < 992) { if (state) drawCursor32(x,y,state); x+=32; } } else if (c == PS2_UPARROW) { if (y > 0) { if (state) drawCursor32(x,y,state); y-=32; } } else if (c == PS2_DOWNARROW) { if (y < 640) { if (state) drawCursor32(x,y,state); y+=32; } } else { char s[]={c,0}; drawText32(s,x,y); x+=32; } } else { if (millis()-last > 500) { drawCursor32(x,y,state); last=millis(); } } } void drawCursor32(int x, int y, int& s) { int i,j; s = 1-s; for(i=x; i>i))!=0; for(int a=0; a<4; ++a)for(int b=0; b<4; ++b) { VGA.drawPixel(x+4*i+a,y+4*j+b,p); } } x+=32; } }