• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*jslint node:true, vars:true, bitwise:true, unparam:true */
2/*jshint unused:true */
3/*
4* Author:  Takahiro Poly Horikawa <horikawa.takahiro@gmail.com>
5* Copyright (c) 2015 Intel Corporation.
6*
7* Permission is hereby granted, free of charge, to any person obtaining
8* a copy of this software and associated documentation files (the
9* "Software"), to deal in the Software without restriction, including
10* without limitation the rights to use, copy, modify, merge, publish,
11* distribute, sublicense, and/or sell copies of the Software, and to
12* permit persons to whom the Software is furnished to do so, subject to
13* the following conditions:
14*
15* The above copyright notice and this permission notice shall be
16* included in all copies or substantial portions of the Software.
17*
18* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25*/
26var st7735 = require('jsupm_st7735');
27
28var lcd = new st7735.ST7735(10, 7, 9, 8);
29lcd.fillScreen(st7735.ST7735_RED);
30lcd.refresh();
31
32lcd.fillScreen(st7735.ST7735_CYAN);
33lcd.refresh();
34
35lcd.fillScreen(st7735.ST7735_BLACK);
36lcd.refresh();
37
38lcd.drawLine(10, 10, 10, 100, st7735.ST7735_MAGENTA);
39lcd.drawLine(20, 20, 10, 100, st7735.ST7735_YELLOW);
40lcd.drawLine(30, 30, 10, 100, st7735.ST7735_WHITE);
41lcd.refresh();
42
43lcd.drawPixel(20, 20, st7735.ST7735_GREEN);
44lcd.refresh();
45
46lcd.drawTriangle(50, 50, 80, 80, 60, 90, st7735.ST7735_GREEN);
47lcd.refresh();
48
49lcd.drawCircle(100, 110, 10, st7735.ST7735_BLUE);
50lcd.refresh();
51
52lcd.setTextWrap(0x0);
53
54lcd.setCursor(0, 30);
55lcd.setTextColor(st7735.ST7735_RED, st7735.ST7735_RED);
56lcd.setTextSize(1);
57lcd.print('Hello World!');
58
59lcd.setCursor(10, 50);
60lcd.setTextColor(st7735.ST7735_RED, st7735.ST7735_RED);
61lcd.setTextSize(2);
62lcd.print('BIG');
63
64lcd.refresh();
65
66