openlcb / OpenLCB_Single_Thread

OpenLCB stack based on ArduinoIDE
GNU Lesser General Public License v2.1
2 stars 9 forks source link

Missing can.h file when using mega #1

Open dsj782 opened 5 years ago

dsj782 commented 5 years ago

When using a mega, I get "fatal error: can.h: No such file. I am not sure if any other libs are needed for this project. Thanks

dpharris commented 5 years ago

Will check it out! David

On Saturday, July 27, 2019, dsj782 notifications@github.com wrote:

When using a mega, I get "fatal error: can.h: No such file. I am not sure if any other libs are needed for this project. Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AAEDQSXUISO7NS4VHZ6NJZDQBSXWJA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HB3XEYQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEDQSTEKO2GHXUMQX4BRW3QBSXWJANCNFSM4IHKTRZQ .

kiwi64ajs commented 5 years ago

Hmmm…

I think we should refactor the existing code to move all the CAN support files out from the core OpenLCB code, so it can be processor independent, but define a interface/adaptor class that the OpenLCB stack knows how to: do things like init(), read(), write() etc.

Then we can leave that implementation up to the developer. If we moved the existing code that already implements the interface into its own separate tree we, could still include it to achieve a similar outcome to what we have now but not require it, if people want to do their own thing.

Alex

On 28/07/2019, at 8:59 AM, David Harris notifications@github.com wrote:

Will check it out! David

On Saturday, July 27, 2019, dsj782 notifications@github.com wrote:

When using a mega, I get "fatal error: can.h: No such file. I am not sure if any other libs are needed for this project. Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AAEDQSXUISO7NS4VHZ6NJZDQBSXWJA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HB3XEYQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEDQSTEKO2GHXUMQX4BRW3QBSXWJANCNFSM4IHKTRZQ .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AB5Y53MM2Q6BTANJ3UNMBELQBSZLDA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26SRWA#issuecomment-515713240, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5Y53KEA3APJUILO5CWV3DQBSZLDANCNFSM4IHKTRZQ.

dpharris commented 5 years ago

Alex --

That is essentially what happens now, although I have duplicated the adapter class into each processor sub-directory. Since we have no control over the underlying CAN libraries, I think keeping a local copy is a good idea, since then the code will work and not break with some change in the parent library. Other developers can adapt CAN libs as they need them.

We require the processor.h file anyway, since different processors have different levels of EEPROM support, and each has its own method of soft reboot, among other things.

David

On Sat, Jul 27, 2019 at 2:11 PM Alex Shepherd notifications@github.com wrote:

Hmmm…

I think we should refactor the existing code to move all the CAN support files out from the core OpenLCB code, so it can be processor independent, but define a interface/adaptor class that the OpenLCB stack knows how to: do things like init(), read(), write() etc.

Then we can leave that implementation up to the developer. If we moved the existing code that already implements the interface into its own separate tree we, could still include it to achieve a similar outcome to what we have now but not require it, if people want to do their own thing.

Alex

On 28/07/2019, at 8:59 AM, David Harris notifications@github.com wrote:

Will check it out! David

On Saturday, July 27, 2019, dsj782 notifications@github.com wrote:

When using a mega, I get "fatal error: can.h: No such file. I am not sure if any other libs are needed for this project. Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AAEDQSXUISO7NS4VHZ6NJZDQBSXWJA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HB3XEYQ , or mute the thread < https://github.com/notifications/unsubscribe-auth/AAEDQSTEKO2GHXUMQX4BRW3QBSXWJANCNFSM4IHKTRZQ

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AB5Y53MM2Q6BTANJ3UNMBELQBSZLDA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26SRWA#issuecomment-515713240>, or mute the thread < https://github.com/notifications/unsubscribe-auth/AB5Y53KEA3APJUILO5CWV3DQBSZLDANCNFSM4IHKTRZQ .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AAEDQSRC7GPUYAEYIQ5BQP3QBS2Z5A5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26SXAI#issuecomment-515713921, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEDQSXAT2SHIIHIYWOLWK3QBS2Z5ANCNFSM4IHKTRZQ .

dpharris commented 5 years ago

Can I assume that you have a Mega and are using a MCP2515 for CAN support? If so, I have fixed it in the master branch.

Please reload the library and try again.

David

On Sat, Jul 27, 2019 at 1:59 PM David Harris drdpharris@gmail.com wrote:

Will check it out! David

On Saturday, July 27, 2019, dsj782 notifications@github.com wrote:

When using a mega, I get "fatal error: can.h: No such file. I am not sure if any other libs are needed for this project. Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AAEDQSXUISO7NS4VHZ6NJZDQBSXWJA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HB3XEYQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEDQSTEKO2GHXUMQX4BRW3QBSXWJANCNFSM4IHKTRZQ .

dsj782 commented 5 years ago

Yes. Mega and a CAN shield MCP2515. Now getting: /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCP2515can.cpp:650:11: warning: missing terminating " character

error "Unrecognized cpu by MCP2515 libraries

       ^

/home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCPcan.cpp: In member function 'virtual void Can::init()': /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCPcan.cpp:37:12: warning: return-statement with a value, in function returning 'void' [-fpermissive] return true; ^ Sketch uses 18578 bytes (7%) of program storage space. Maximum is 253952 bytes. Global variables use 1038 bytes (12%) of dynamic memory, leaving 7154 bytes for local variables. Maximum is 8192 bytes. Invalid library found in /home/don/Arduino/libraries/Arduino-master: no headers files (.h) found in /home/don/Arduino/libraries/Arduino-master Invalid library found in /home/don/Arduino/libraries/Arduino-master: no headers files (.h) found in /home/don/Arduino/libraries/Arduino-master

kiwi64ajs commented 5 years ago

Hi David H

On 28/07/2019, at 9:35 AM, David Harris notifications@github.com wrote:

Alex --

That is essentially what happens now, although I have duplicated the adapter class into each processor sub-directory. Since we have no control over the underlying CAN libraries, I think keeping a local copy is a good idea, since then the code will work and not break with some change in the parent library. Other developers can adapt CAN libs as they need them.

Yes agreed, but with what we have now, it's difficult to choose any other option apart from what has been predetermined. Sure you can keep adding #defines and #if’s but it quickly becomes quite brittle and hard to maintain.

By moving that code out of the core and not trying to keep embracing every combination of CPU / CAN Transceiver, we reduce code constraints and don’t dictate to developers what they have to do…

I’m yet to delve into that code much yet, so you’ll know better than I will, but I’m sure we can take what we have and separate it out a bit so each piece is independent then, devs can use our predefined adaptor classes or roll their own.

We require the processor.h file anyway, since different processors have different levels of EEPROM support, and each has its own method of soft reboot, among other things.

I was just looking at that too and all that EEPROM stuff should probably move into the NodeMemory class as that is where I’ve pushed a lot of EEPROM type calls from various locations.

I was imagining some sort of EEPROM_Modified flag and a Flush timer to handle the EEPROM_Begin and EEPROM_Commit that you’ve added in a few places but I will have broken… ;(

Alex

dpharris commented 5 years ago

Hi DSJ --

The 'missing terminating " character' was me forgetting a ". Should be fixed now.

Are you choosing "Arduino/Genuino Mega or Mega2560"? Thanks David

On Sat, Jul 27, 2019 at 7:19 PM dsj782 notifications@github.com wrote:

Yes. Mega and a CAN shield MCP2515. Now getting: /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCP2515can.cpp:650:11: warning: missing terminating " character

error "Unrecognized cpu by MCP2515 libraries

^ /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCPcan.cpp: In member function 'virtual void Can::init()': /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCPcan.cpp:37:12: warning: return-statement with a value, in function returning 'void' [-fpermissive] return true; ^ Sketch uses 18578 bytes (7%) of program storage space. Maximum is 253952 bytes. Global variables use 1038 bytes (12%) of dynamic memory, leaving 7154 bytes for local variables. Maximum is 8192 bytes. Invalid library found in /home/don/Arduino/libraries/Arduino-master: no headers files (.h) found in /home/don/Arduino/libraries/Arduino-master Invalid library found in /home/don/Arduino/libraries/Arduino-master: no headers files (.h) found in /home/don/Arduino/libraries/Arduino-master

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AAEDQSWGNUTNDOMKFXULE3LQBT6ZZA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26V6RI#issuecomment-515727173, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEDQSVENQGLADI6RACTKNLQBT6ZZANCNFSM4IHKTRZQ .

dpharris commented 5 years ago

Oh, if you are compiling OlcbBasicNode, then because I did not setup i/o for the Mega, you should uncomment the line: //#define OLCB_NO_BLUE_GOLD which will excise the ButtonLed stuff. You can look at boardChoices.h and adapt for the Mega.

David

On Sat, Jul 27, 2019 at 8:15 PM David Harris drdpharris@gmail.com wrote:

Hi DSJ --

The 'missing terminating " character' was me forgetting a ". Should be fixed now.

Are you choosing "Arduino/Genuino Mega or Mega2560"? Thanks David

On Sat, Jul 27, 2019 at 7:19 PM dsj782 notifications@github.com wrote:

Yes. Mega and a CAN shield MCP2515. Now getting: /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCP2515can.cpp:650:11: warning: missing terminating " character

error "Unrecognized cpu by MCP2515 libraries

^ /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCPcan.cpp: In member function 'virtual void Can::init()': /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCPcan.cpp:37:12: warning: return-statement with a value, in function returning 'void' [-fpermissive] return true; ^ Sketch uses 18578 bytes (7%) of program storage space. Maximum is 253952 bytes. Global variables use 1038 bytes (12%) of dynamic memory, leaving 7154 bytes for local variables. Maximum is 8192 bytes. Invalid library found in /home/don/Arduino/libraries/Arduino-master: no headers files (.h) found in /home/don/Arduino/libraries/Arduino-master Invalid library found in /home/don/Arduino/libraries/Arduino-master: no headers files (.h) found in /home/don/Arduino/libraries/Arduino-master

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AAEDQSWGNUTNDOMKFXULE3LQBT6ZZA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26V6RI#issuecomment-515727173, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEDQSVENQGLADI6RACTKNLQBT6ZZANCNFSM4IHKTRZQ .

kiwi64ajs commented 5 years ago

Hi Guys,

1) I’ve done quite a bit on my AJS-Development branch:

2) I checked every I/O on the RailStars board to make sure they were working correctly. There was a bug with the EventID search for the very first EventID, which is fixed

3) Can you check that the Tiva code works for you now and that I didn’t mess up the pin number that you’d changed to, because if its good now, I’d like to merge my branch back into master so we’re not toggling back and forward between OpenLCB library refactorings, and get back onto common code ASAP.

Alex

On 28/07/2019, at 3:20 PM, David Harris notifications@github.com wrote:

Oh, if you are compiling OlcbBasicNode, then because I did not setup i/o for the Mega, you should uncomment the line: //#define OLCB_NO_BLUE_GOLD which will excise the ButtonLed stuff. You can look at boardChoices.h and adapt for the Mega.

David

On Sat, Jul 27, 2019 at 8:15 PM David Harris drdpharris@gmail.com wrote:

Hi DSJ --

The 'missing terminating " character' was me forgetting a ". Should be fixed now.

Are you choosing "Arduino/Genuino Mega or Mega2560"? Thanks David

On Sat, Jul 27, 2019 at 7:19 PM dsj782 notifications@github.com wrote:

Yes. Mega and a CAN shield MCP2515. Now getting: /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCP2515can.cpp:650:11: warning: missing terminating " character

error "Unrecognized cpu by MCP2515 libraries

^ /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCPcan.cpp: In member function 'virtual void Can::init()': /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCPcan.cpp:37:12: warning: return-statement with a value, in function returning 'void' [-fpermissive] return true; ^ Sketch uses 18578 bytes (7%) of program storage space. Maximum is 253952 bytes. Global variables use 1038 bytes (12%) of dynamic memory, leaving 7154 bytes for local variables. Maximum is 8192 bytes. Invalid library found in /home/don/Arduino/libraries/Arduino-master: no headers files (.h) found in /home/don/Arduino/libraries/Arduino-master Invalid library found in /home/don/Arduino/libraries/Arduino-master: no headers files (.h) found in /home/don/Arduino/libraries/Arduino-master

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AAEDQSWGNUTNDOMKFXULE3LQBT6ZZA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26V6RI#issuecomment-515727173, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEDQSVENQGLADI6RACTKNLQBT6ZZANCNFSM4IHKTRZQ .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AB5Y53JZSYX333QYOWNS7BDQBUGA3A5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26WQ2Q#issuecomment-515729514, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5Y53JMQ4YME6ZBYHSVDO3QBUGA3ANCNFSM4IHKTRZQ.

dsj782 commented 5 years ago

I am back from the great north. I see more work was done on the code, and I thank you guys. Still having issues. JMRI 4.15.5 on a laptop. Also have RR-Cikrts Signal and Tower card, with an usb interface. Using A Mega 2560, with a MPC2515 shield from DIYMORE.COM. The first time I compile and upload I get errors, but then it compiles and uploads cleanly after that. I uncomment the #define OLCB_NO_BLUE_GOLD I also uncomment the #define NEW_NODEID 2,1,13,0,0,0x06 First push: /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCPcan.cpp: In member function 'virtual void Can::init()': /home/don/Arduino/libraries/OpenLCB_Single_Thread-master/src/MCP2515/MCPcan.cpp:37:12: warning: return-statement with a value, in function returning 'void' [-fpermissive] return true; ^ Sketch uses 18560 bytes (7%) of program storage space. Maximum is 253952 bytes. Global variables use 1030 bytes (12%) of dynamic memory, leaving 7162 bytes for local variables. Maximum is 8192 bytes.

But then it compile the second time with no warnings/errors. BUT. Nothing seems to happen. I get "OlcbBasicNode" in the serial monitor. I see nothing in JMRI's LCC traffic monitor. I can see the tower and signal cards. I can the light flicker when I generate an event (via RR-Cirkts push button card.) on the MPC2515 card. I can see that event in traffic monitor.

I am not sure what I am to do in the BoardChocies.h file. I see no define for a mega. I tried uncommenting each of the board types, but still same results.

The JMRI's "configure nodes" screen does not show anything but the jmri, tower, and signal card. Nothing for the Arduino.

Just for kicks, I tried a UNO arduino. That one does show in the CDI, but just the address. Can't click on it. But it does show traffic for that address in the monitor when I upload or press the reset button.

For another just for kicks, I tried my ESP8226 card. I didn't expect that to work. I ordered a ESP32 card, so I will wait till it arrives. My question: When using the ESp32 card, where is the CAN bus? Are you using the IP stack instead?

dsj782 commented 5 years ago

Another good news. Using the UNO, I was able to get the CDI to work, via JMRI. I had to ground pin 4 and it popped up in the LCC config screen. The only problem I have, is I don't know what pin does what..Nothing in the boardchoices.h file seems to line up.

dpharris commented 5 years ago

Describe what you are trying to do, and we can help! :-)

David

On Mon, Aug 19, 2019 at 11:41 AM dsj782 notifications@github.com wrote:

Another good news. Using the UNO, I was able to get the CDI to work, via JMRI. I had to ground pin 4 and it popped up in the LCC config screen. The only problem I have, is I don't know what pin does what..Nothing in the boardchoices.h file seems to line up.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AAEDQSU3JKFHGI7LC4MD7SDQFLSPJA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4T5J4I#issuecomment-522704113, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEDQSSC2AOVV7Y4EMFQASDQFLSPJANCNFSM4IHKTRZQ .

dsj782 commented 5 years ago

The main goal is signaling. I belong to the Detroit Model Rail Road Club, in Holly Michigan. We are in the "testing the various" solutions phase. One of my tasks is the "signal repeater boards". Due to our size, we found that a lot of the signals can not be seen directly (or within our old-man eye sight). So the idea of repeater boards was suggested. Some of these boards will not be easily accessible, once mounted. And to keep costs down, I am looking at Arduinos. Right now, my arduinos can see the events and set LED pins accordingly. I am using a different library, but it does not support CDI or any remote configurations. The arduinos have to be hard-coded with the event IDs. I would like to be able to use JMRI / CDI to configure them.

I have tried several different libraries and this one has shown the most promise.

Currently I am using UNOs. JMRI will see the address in the LCC Configure screen but to see the CDI, I have to ground pin 4. When I have the CDI displayed, I am not sure what pins are responding to events, or which pins are enabled when producing an event.

Which "button lib" are you using? I am confused how that lib is used.

What define in boardchoice.h should I be using? None of the descriptions say UNO, or MEGA. From what I can guess, this file describes which pins are used. This is an area where my knowledge of Arduinos is limited.

As far as the "grounding pin 4", is this what they mean by the BLUE/GOLD buttons? If I have to push a button on the Arduino to configure it, that makes this a little less usable.

When I try the MEGA, none of the pins respond to grounding (except one will reset the board). In JMRI, the address shows up in the LCC node configure screen but can not click on it, to start the CDI.

dpharris commented 5 years ago

I, too, am confused. I do not know what pin 4 refers to.

  1. Are you using a standard Uno?
  2. Are you using CAN, and if so how is it connected on the UNO?
  3. What Sketch are you using?

The sketches are only example sketches and need to be modified for your use. The boardChoices are just samples again, which match the CDI. ButtonLED is a library that uses a pin as both output and input. It samples the input by turning off the output temporarily and reading the input. It also implements a 'pattern' that will flash the output in different ways. You can just use digitalRead and digitalWrite instead. Blue/Gold is optional, especially if you use JMRI, or similar, for configuration.

If you can write up a specification of what you want, then I can lead you through the steps to make it work.

For example:

  1. Use bicolor, three lead LEDs to display Red, Yellow, Green, and flashing Yellow indications.
  2. One eventid for each indication.

UNO pins can be referenced by pin number, so one can do: const int n_signals; int signals[n_signals]; int outputs[n_signals][3] = { {2,3}, {4,6}, {7,11}, {12,18} }; // 3 lead LEDs, two pins and a ground // ===== Process Consumer-eventIDs ===== // USER defined void pceCallback(unsigned int index) { int indication = index % 4; // which indication. There are four eventids, one for each indication int signal = index / 4; // which signal signals[signal] = indication; // set the signal to the indication } void processIndications() { // call from main loop. // drives the outputs, every FLASHRATE milliseconds

define FLASHRATE 500

 static bool flash = false;
 static long next = 0;
 if(next>millis()) return; // only process at flash rate
 next += FLASHRATE;
 for(int i=0;i<n_signals;i++) {
   digitalWrite(outputs[i][0], LOW};
   digitalWrite(outputs[i][1], LOW};
   if(signals[i] == 0) { digitalWrite(outputs[i][0], HIGH);

digitalWrite(outputs[i][1], LOW); } // Red else if(signals[i] == 1) { digitalWrite(outputs[i][0], HIGH); digitalWrite(outputs[i][1], HIGH); } // Yellow else if(signals[i] == 2) { digitalWrite(outputs[i][0], LOW); digitalWrite(outputs[i][1], HIGH); } // Green else if(signals[i] == 3 && flash) { digitalWrite(outputs[i][0], HIGH); digitalWrite(outputs[i][1], HIGH); } // Flash Yellow else { digitalWrite(outputs[i][0], LOW); digitalWrite(outputs[i][1], LOW); } // or off flash = ~flash; // invert flash }

Take with large grain of salt: off top of hard coding.

David

On Tue, Aug 20, 2019 at 9:41 AM dsj782 notifications@github.com wrote:

The main goal is signaling. I belong to the Detroit Model Rail Road Club, in Holly Michigan. We are in the "testing the various" solutions phase. One of my tasks is the "signal repeater boards". Due to our size, we found that a lot of the signals can not be seen directly (or within our old-man eye sight). So the idea of repeater boards was suggested. Some of these boards will not be easily accessible, once mounted. And to keep costs down, I am looking at Arduinos. Right now, my arduinos can see the events and set LED pins accordingly. I am using a different library, but it does not support CDI or any remote configurations. The arduinos have to be hard-coded with the event IDs. I would like to be able to use JMRI / CDI to configure them.

I have tried several different libraries and this one has shown the most promise.

Currently I am using UNOs. JMRI will see the address in the LCC Configure screen but to see the CDI, I have to ground pin 4. When I have the CDI displayed, I am not sure what pins are responding to events, or which pins are enabled when producing an event.

Which "button lib" are you using? I am confused how that lib is used.

What define in boardchoice.h should I be using? None of the descriptions say UNO, or MEGA. From what I can guess, this file describes which pins are used. This is an area where my knowledge of Arduinos is limited.

As far as the "grounding pin 4", is this what they mean by the BLUE/GOLD buttons? If I have to push a button on the Arduino to configure it, that makes this a little less usable.

When I try the MEGA, none of the pins respond to grounding (except one will reset the board). In JMRI, the address shows up in the LCC node configure screen but can not click on it, to start the CDI.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlcb/OpenLCB_Single_Thread/issues/1?email_source=notifications&email_token=AAEDQSSYIUGJB2FM2WOS3ELQFQNDDA5CNFSM4IHKTRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4W5GNI#issuecomment-523096885, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEDQSQN6BFRKF626HV4QZDQFQNDDANCNFSM4IHKTRZQ .

dsj782 commented 5 years ago

An original UNO R3. I tried one of the cheap ones, with same results. But I always do my testing on the good boards. The CAN board is a "MCP2515 Can Bus Shield Board SPI Interface 9 Pins Standard Sub-D Connector Expansion Module DC 5-12V for Arduino Seeeduino ". (cut and pasted from Amazon.). Now this board does say v1.2 and their website says there is a v2 board. From www.diymore.cn (imprinted on the board). The MEGAs are from Inland (Microcenter). Pin 4 is the digital pin 4. Not the analog pin A4.

I have never used one pin for both a button and LED. I think this is the cause of some of my confusion.

I am using the example OlcbBasicNode from your zip file. I un-comment the define OLCB_NO_BLUE_GOLD line. If I don't, I get a compile error, " 'pA' was not declared in scope"

So I do need to figure out the buttons and modify the example. I will try your code tomorrow (as tonight is club night) and let you know how it turns out.

Thanks again.

dsj782 commented 5 years ago

One more comment. I do have RR-CIKT's Signal and Tower cards working. I have a BOD8 for occupancy detection, and using JMRI's logix to drive the signals, via the Signal card. We have one interlock working (with occupancy) but only driving LEDs on a bread board for now. Someone else is working on the physical Signals. This project has been fascinating. I have learned more about signaling in the past month, then I learned the last 50 years, thanks to guys like you.

dsj782 commented 5 years ago

I found an older git hub library, that explains a lot of the code. I am still having an issue with the ButtonLed library. Which one (of many) are you using? It looks cool, but I can not find any mention of which one.