![]() ![]() ![]() JMRI 2001 - 2005įor (int k=3 k<=8 k++) I ended up having to keep a small fixed delay of 5ms in there as it became inaccurate, but this way I have stopped getting ghost trains appearing and the response from all the other items, lights, sensors and turnouts is much better. Uncomment when additional lights are required. Reads bit 0 to 4 of packet and sets the pins 9-13 to high/low (CMRI bits 1-5) ![]() Uncomment when additional sensors are required. 2: Sensor Process - Get sensor information and send to JMRI, reads pins 3-8 and sends bit 4-9 on packet (CMRI bits 4-9) #define DE_PIN 2 // 485 bus pin - DO NOT CHANGEįor (int k=3 k maxReading) maxReading = currentReading įor (i=0 i maxReading) maxReading = currentReading #define CHECK 10 // CHANGE THIS TO ADJUST THE NUMBER OF CHECKS EACH CT MODULE PERFORMS ![]() #define OFFSET 50 // CHANGE THIS TO ADJUST SENSITIVITY OF BLOCK DETECTION - LOWER NUMBER IS MORE SENSITIVE Note - Node 1 appears to need +4 compared to other nodes. #define DELAY 10 // DELAY ALLOWS TIME TO PROCESS MAX AND MIN VALUES #define CMRI_ADDR 2 // CHANGE THIS TO MATCH NODE Definitions used - These values can be changed Part of the Brynderwyn Layout installation. This can be used to switch on LED's, relays and The light process monitors CMRI and writes to digital This can be adjusted if more sensors are required. Sensors canĬonsist of buttons, reed switches, or many other items. The sensor process monitors digital pins 3-8. A max and min value is calculated andĬompared to the offset value to determine whether a block Will process readings from the CT modules by reading theĪnalog pins 0-4. This sketch is for Node 2 of the CMRI network. This is an Arduino sketch for the Brynderwyn layout. I could spend a few weeks knuckling down and trying to sort this out myself but I'm in a bit of a time crunch so was hoping someone out there with a bit of Arduino knowledge might be able to just throw the answer my way. Now I know I have to introduce some sort of way of delaying the clearing of the !digitalread bit long enough that the CMRI polling has enough time to read it, probably by using Millis the StateChangeDetection example and an array of some sort, but this is where my limited programming knowledge has hit the wall and Google is not throwing up anything useful. Which works fine when the loco is going slowly over the reed switch but as soon as I introduce any sort of speed JMRI doesn't pick up the momentary action. The problem I have is with getting a reed switch activation to be recognised by JMRI when the loco is traveling faster than snails pace.Īt the moment I am just using the standard Everything is working ok, my turnouts move, CT block detection works fine and my reed switches operate. I've got my JMRI set up with a node network of 3 Nano's and 1 Uno running at 19200. Hey guys, I've been scratching my head for a few days trying to work out how to solve this problem. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |