Hardware Reference
In-Depth Information
125 rc = getch(); /
Wait for keystroke
/
126
127 mutex_lock(); /
Lock curses
/
128 mvaddch(7,12,rc); /
Echo character that was typed
/
129 refresh();
130 mutex_unlock(); /
Release curses
/
131
132 switch ( rc ) {
133 case '0' :
134 /
/
135 rc = zmq_send(console,"led : 0",5,0);
136 assert(rc !=−1);
137 break;
138 case '1' :
139 /
Tell sensor to turn off LED
/
140 rc = zmq_send(console,"led: 1",5,0);
141 assert(rc!=−1);
142 break ;
143 case'x' :
144 case'X' :
145 rc = zmq_send(console,"stop :",5,0);
146 assert(rc!=−1);
147 break;
148 case 'q' :
149 case 'Q' :
150 /
Tell sensor to turn on LED
Quit the command console
/
151 sleep(1);
152 clear();
153 refresh();
154 endwin();
155 exit(0);
156 break;
157 default :
158 ;
159 }
160 }
161 }
162
163 /
164
Main thread : init/receive published SW1/LED status updates
165
166
Specify the IP number or hostname of the sensor on the command
167
line as argument one : $ ./console myrasp
168
/
169 int
Search WWH ::




Custom Search