======= Example ======= A simple example of a program that reads from the CAN bus and another program that writes to the CAN Bus is in directory "example". There are two Makefiles there that can be used to compile the example programs. How to build ------------ If you don't have installed socan, use local libraries:: (cd .. && make) make -f Makefile.local If you have installed socan in /usr/local, use global libraries:: make -f Makefile.installed How to run ---------- Enter:: ./runtest.sh The output on the console should look like this:: Start 'read' program... read: initialize CAN object for reading. COB: 1 Port: 0 Length: 4 Timeout: 10000 read: wait for data Start 'write' program... write: initialize CAN object for writing. COB: 1 Port: 1 Length: 4 Timeout: 10000 write: send data: 00 01 02 03 read: socan_read returned: SOCAN_OK write: socan_write returned: SOCAN_OK read: data received: 00 01 02 03 How it works ------------ Here is the Makefile, "Makefile.installed" that uses socan libraries and headers installed in directory "/usr/local": .. literalinclude:: ../example/Makefile.installed :language: MAKE Here is the complete source of program "read.c": .. literalinclude:: ../example/read.c :language: C Here is the complete source of program "write.c": .. literalinclude:: ../example/write.c :language: C Here is the shell script "runtest.sh": .. literalinclude:: ../example/runtest.sh :language: bash