Demo in a few videos - manu-fwi/openlcb-gateway GitHub Wiki
The 2 videos show how you can wire up a cpnode (here on a arduino mega) to jmri using openlcb. On the laptop are running: jmri and openlcb-gateway+cmri_net_serial programs. - openlcb-gateway is handling all the openlcb mumbo-jumbo (events, CDI, memory reads/writes, alias negotiation…). The gateway connects to jmri using network so can be far and using wifi if needed - the cmri_net_serial program is the one in charge of talking to the cpnode; here it runs on the laptop but it actually connects via the net, so it can be far and connect via wifi to the gateway program The cpnode (v1.5 of the firmware) is 8INS/8OUTS no IOX. Only one input is wired to a temp switch and an out to a LED.
First video (https://drive.google.com/file/d/1zkdZe358Njx4FC2O88Vg4UyaZJlJHQwR/view?usp=sharing) shows the JMRI openlcb frame monitor on top and you can guess (more than see) that when button is pressed/released an event is generated and dispatched.
Second video (https://drive.google.com/file/d/1QS9mCfaYUV-8uIw6zff_x4Q_qTIpexEa/view?usp=sharing) shows how you control the cpnode output by sending an event (the correspondance of the event with the output or input for that matter is made using CDI, cf screen shots below).
The third video (https://drive.google.com/open?id=1hqtz1GZeKaqSri-odoNcgbivnVUNPuyA) shows a turnout controlled by an RR-duino node (cf github.com/manu-fwi/RR-duino). The push button generates openlcb events that are consumed by the turnout. Moreover the turnout generates events when it reaches its final position (it is moved by a servo at relatively slow pace) which are consumed by the node to control 2 outputs (the leds). All of this is completely autonomous, JMRI is not even needed.
Screenshots:
-
the CDI window (https://drive.google.com/file/d/1f88KybsGagWwC8Duwpx9tS7lBpWY93q2/view?usp=sharing) where you can see in Channel 1 the 2 events sent by the first input state changes. You can also see the IOX expansion partly.
-
The openlcb monitor (https://drive.google.com/file/d/1pTeSsqg9JUEFQpX7P6kzK1uKbhhMNgA1/view?usp=sharing) where you can see the events received when toggling the switch one the cpnode input.
-
The openlcb frame generator of jmri (https://drive.google.com/file/d/1T_a7RuM1f2Q_HWobwPO8P-6k7raZrF2I/view?usp=sharing): to the right of the "Send event produced" button you can see the event that will switch off the led.
Hope this helps to figure out what all this is doing.