Hardware Reference
In-Depth Information
If you also want C++ support for ØMQ, you can perform the following additional
steps (we'll use only the C API in this chapter):
1. git clone https://github.com/zeromq/cppzmq.git
2. cd cppzmq
3. sudo cp zmq.hpp /usr/local/include/
Compiling and Linking
When compiling source code using ØMQ, you need to specify only the directory where
the include files were installed:
-I /usr/local/include
For linking, you need the following linker options:
-L/usr/local/lib -lzmq
-Wl,-R/usr/local/lib
The last option tells the executable where to find the ØMQ shared libraries at
runtime. Exclude that option when linking on the Mac (or use the provided makefile
target mac_console ).
$ make
gcc -c -Wall -O0 -g -I/usr/local/include -Wall -O0 -g sensor.c -o sensor.o
gcc sensor.o -o sensor -L/usr/local/lib -lzmq -lncurses -Wl, -R/usr/local/lib
sudo chown root ./sensor
sudo chmod u+s ./sensor
gcc -c -Wall -O0 -g -I/usr/local/include -Wall -O0 -g console.c -o console.o
gcc -console.o -o console -L/usr/local/lib -lzmq -lncurses -Wl,
-R/usr/local/lib
Sensing Station Design
Our Raspberry Pi sensing station will use the CD4013 flip-flop circuit to debounce one
switch or SPDT push button. The Pi station will also consist of one LED that will be
controlled by the multiple software consoles.
If you need to imagine some kind of use case, imagine that the Raspberry Pi is
controlling a jail cell door. The guard who wants to open a door pushes a microswitch
button to show SW1=On on the remote consoles (as a request indication). After the
monitoring agents check their video monitor, one of them agrees to honor the request
by entering 1 on the console (which lights the LED) to open the jail cell door. Pressing 0
closes the latch again (turns off the LED).
 
Search WWH ::




Custom Search