1 /*
2 * Author: Sergey Kiselev <sergey.kiselev@intel.com>
3 * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
4 * Copyright (c) 2014 - 2015 Intel Corporation.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 #include <lcm1602.h>
27
28 int
main(int argc,char ** argv)29 main(int argc, char **argv)
30 {
31 //! [Interesting]
32 // LCD connection:
33 // LCD RS pin to digital pin 8
34 // LCD Enable pin to digital pin 13
35 // LCD D4 pin to digital pin 2
36 // LCD D5 pin to digital pin 3
37 // LCD D6 pin to digital pin 4
38 // LCD D7 pin to digital pin 5
39 // LCD R/W pin to ground
40 // 10K trimmer potentiometer:
41 // ends to +5V and ground
42 // wiper to LCD VO pin (pin 3)
43 upm::Lcm1602 *lcd = new upm::Lcm1602(8, 13, 2, 3, 4, 5, 20, 2);
44 lcd->setCursor(0,0);
45 lcd->write("Hello World");
46 lcd->setCursor(1,2);
47 lcd->write("Hello World");
48
49 printf("Sleeping for 5 seconds\n");
50 sleep(5);
51 delete lcd;
52 //! [Interesting]
53 return 0;
54 }
55