rc433/send.c

changeset 20
f7f9463cdefd
child 22
a3b058c67289
equal deleted inserted replaced
19:eaa03048c269 20:f7f9463cdefd
1 /*****************************************************************************
2 * Copyright (C) 2014
3 *
4 * Michiel Broek <mbroek at mbse dot eu>
5 *
6 * This file is part of the mbsePi-apps
7 *
8 * This is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * mbsePi-apps is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with EC-65K; see the file COPYING. If not, write to the Free
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *****************************************************************************/
22
23 #include "../lib/mbselib.h"
24 #include "send.h"
25
26
27 int main(int argc, char *argv[]) {
28
29 /*
30 output PIN is hardcoded for testing purposes
31 see https://projects.drogon.net/raspberry-pi/wiringpi/pins/
32 for pin mapping of the raspberry pi GPIO connector
33 */
34 int PIN = 0;
35 int systemCode = atoi(argv[1]);
36 int unitCode = atoi(argv[2]);
37 int command = atoi(argv[3]);
38
39 if (wiringPiSetup () )
40 return 1;
41
42 printf("sending systemCode[%d] unitCode[%i] command[%i]\n", systemCode, unitCode, command);
43 enableTransmit(PIN);
44
45 switch(command) {
46 case 1:
47 switchOn(systemCode, unitCode);
48 break;
49 case 0:
50 switchOff(systemCode, unitCode);
51 break;
52 default:
53 printf("command[%i] is unsupported\n", command);
54 return -1;
55 }
56
57 return 0;
58 }

mercurial