Stap 3: Learning to Draw
Nu we weten de LCD werken, laten we leren hoe een vak te tekenen.
Of afhankelijk van de oriëntatie van het scherm u wellicht niet Bel het setRot commando.
drawBox() is wat trekt het 4 bij 4-vak op het scherm. Zoals u zien kunt, is coördinaat 0,0 dat de linkerbovenhoek van het scherm.
// Arduino Pong v0.0 by Hari Wiguna, 2016 #include "U8glib.h" U8GLIB_PCD8544 u8g(13,11, 9,8,10); // SPI Com: SCK = 13, MOSI = 11, CS = 9, A0/DataCommand = 8, Reset = 10 void setup(void) { u8g.setRot180(); // flip screen (if necessary) } void loop(void) { u8g.firstPage(); do { u8g.drawBox(0,0, 4,4); } while ( u8g.nextPage() ); }