chiark / gitweb /
Aded lcd-adafruit to test/drive the Adafruit RGB LCD plate
[wiringPi.git] / examples / q2w / blink-io.c
1 /*
2  * blink-io.c:
3  *      Simple "blink" test for the Quick2Wire 16-pin IO board.
4  *
5  * Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
6  ***********************************************************************
7  * This file is part of wiringPi:
8  *      https://projects.drogon.net/raspberry-pi/wiringpi/
9  *
10  *    wiringPi is free software: you can redistribute it and/or modify
11  *    it under the terms of the GNU Lesser General Public License as published by
12  *    the Free Software Foundation, either version 3 of the License, or
13  *    (at your option) any later version.
14  *
15  *    wiringPi is distributed in the hope that it will be useful,
16  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *    GNU Lesser General Public License for more details.
19  *
20  *    You should have received a copy of the GNU Lesser General Public License
21  *    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
22  ***********************************************************************
23  */
24
25 #include <stdio.h>
26 #include <wiringPi.h>
27 #include <mcp23017.h>
28
29 #define LED             1
30 #define Q2W_BASE        100
31
32 int main (void)
33 {
34
35 // Enable the on-goard GPIO
36
37   wiringPiSetup () ;
38
39 // Add in the mcp23017 on the q2w board
40
41   mcp23017Setup (Q2W_BASE, 0x20) ;
42
43   printf ("Raspberry Pi - Quick2Wire MCP23017 Blink Test\n") ;
44
45 // Blink the on-board LED as well as one on the mcp23017
46
47   pinMode (LED, OUTPUT) ;
48   pinMode (Q2W_BASE + 0, OUTPUT) ;
49
50   for (;;)
51   {
52     digitalWrite (LED,          HIGH) ;
53     digitalWrite (Q2W_BASE + 0, HIGH) ;
54     delay (500) ;
55     digitalWrite (LED,          LOW) ;
56     digitalWrite (Q2W_BASE + 0, LOW) ;
57     delay (500) ;
58   }
59
60   return 0 ;
61 }