LCD12864 - Draw sketch
Preparation
- Ameba x 1
- LCD12864 Module x 1
Example
We need the following library:
https://github.com/ambiot/amb1_arduino/raw/master/Arduino_libraries/LCD12864.zip
http://playground.arduino.cc/Code/LCD12864
Please refer to Arduino official tutorial to add .zip library to Ameba:
https://www.arduino.cc/en/Guide/Libraries#toc4
Open the sample code in “File” -> “Examples” -> “AmebaLCD12864” -> “drawsketch”
Wiring diagram:
Code reference
After initialization, call
Render()
to start to draw sketchLCDA.Render()
use DrawCircle(int x0, int y0, int radius)
to draw circle. The first two arguments are the x and y coordinates of the circle, and the third argument is the radius of the circle.
LCDA.DrawCircle(30,135,5);
RenderScreenBuffer(int screen)
is used to specify the screen part where you want to draw sketch (1 = upper part of the screen, 2 = lower part of the screen)
LCDA.RenderScreenBuffer(2);
Draw(bool t, int x, int y)
is used to seitch graphics mode.
(t is true means the graphics mode is on, argument ‘x’ and ‘y’ can be any number.)
(t is false means the ASCII mode is on, argument ‘x’ represents the position of the characters (ranging from 0 to 23), and argument ‘y’ is of no use.
LCDA.Draw(false,4,0);
setPins(int tRS, int tRW, int tD7, int tD6, int tD5, int tD4, int tD3, int tD2, int tD1, int tD0)
specifies data for data lines to draw on LCD screen.
tRS: Register Set
tRW: Read/Write
tD7: Data line 7
tD6: Data line 6
tD5: Data line 5
tD4: Data line 4
tD3: Data line 3
tD2: Data line 2
tD1: Data line 1
tD0: Data line 0
LCDA.setPins(1,0,0,0,1,1,0,0,0,0); //0 LCDA.setPins(1,0,0,0,1,1,0,0,0,1); //1 LCDA.setPins(1,0,0,0,1,1,0,0,1,0); //2