I'm planning a Elegoo Mega 2560, Aurdino Motor shield build. I already have purchased the hardware. Planning on controlling it through JMRI on a Windows PC via USB and WiThrottle for Phone control. I'm looking for the newest/best code for DCC++. The one I'm seeing on github doesn't look like it has been updated in years.
Look at this library : https://github.com/Locoduino/DCCpp . From my point of view, the easiest way to use DCC++ ! And I still continue to maintain and improve it.
I think I'm going to give your code a try. Do I still run the jumper wire from digital 2 to 13 for the Mega?
Looks interesting. How difficult it would be to add support for yet another motor shield? I'm thinking of hacking one to replace current mess of IBT-2 and L298 on my desk. Would throw whatever jumpers are needed, as well as necessary inverters etc.
DCCpp has been made mainly to avoid hard coded hardware. It can be used as usual for classic shields, but also for any other kind of H-Bridge, on a shield or not. The methods beginMain() and beginProg() of DCCpp can be configured to access any power bridge.
Trusty, I tried to use your code but I'm unsure how to get started. I was hoping for a INO file that I could just load and compile and upload. I'm a total noob to Audrino IDE and really don't know how to code or use it.
In the Arduino IDE, you can develop your code to control the micro-controller, but a lot of things have already been coded by thousands of users in the world. Some of them, like me, have made their work available for all others. The form for that is a 'library', a bunch of files and code already developed, tested and able to control some capabilities of the Arduino. You can install my library by using the command 'Sketches/Include a Library/Library Manager' of the IDE, in the menu. I am not sure of the english translation of the menu, I use the french version... In the manager, type 'dccpp' in the input field at the top right of the window. You will find the DCCpp library in its actual version 1.3.7 . Click on the button 'Install' and that's all. To work with my library, use the command 'Files/Samples/DCCpp' and select one the samples as a start for your development. Good luck.
Trusty, Is the DCCpp library free of bug that DCC++ supposedly has when sending 'M' command? Mentioned here: https://groups.io/g/jmriusers/message/152167 "Finally there was a bug in the DCC++ code which was tagging an extra 0 byte on the end of the packet on the rails"
I had been wondering the same thing myself. In reviewing the network graph of original DCC++ BaseStation project on GitHub, it appeared that the bjorniuppsala fork (which itself was forked from the atanisoft fork) was among the most active. DCC++ was compatible with both RocRail and JMRI; Locoduino DCC++ is described as a library, possibly implying that some additional code is needed in order for it to function in conjuction with JMRI or RocRail as a command station. There is also the DcDccNanoController project among the Locoduino projects on GitHub, but that appears to be targeted more for a stand-alone controller as opposed to a command station. There is the following article (dated July 9, 2019) on the Locoduino website about using Arduino with JMRI as a command station, but it links to the original DCC++ BaseStation repository on GitHub. • https://translate.google.com/translate?sl=auto&tl=en&u=https://www.locoduino.org/spip.php?article253 There is also another Locoduino article on getting feedback from Arduino to JMRI. • https://translate.google.com/translate?sl=auto&tl=en&u=https://www.locoduino.org/spip.php?article240 Is using BaseStation still the preferred approach if going for a JMRI+Arduino command station? If so, has anyone worked with any of the more recent forks of BaseStation (such as the bjorniuppsala fork linked above)?
Here is another fork of the DCC++ BaseStation project, this one with a branch that embarked on adding RailCom support. evili DCC++ BaseStation fork with RailCom branch Description of plan for supporting RailCom Not Arduino based, info on but BiDi/RailCom support by the OpenDCC project is linked here.
So Gregg abandoned the project and the original fork has not been picked up by anyone? I just saw this after I have been modifying code on the original fork to deal in Amps instead of pin output values for current sense. Is the bjorn fork the best now? I saw a mention of him modifying currentsense.cpp to "hack non-functioning current sense". Was that a bug? Looks like a lot of other changes. This is all still for an Uno/Mega and the Arduino IDE? How do I get up to speed on all the changes/additions? It looks like the Bjorn/Antani fork has support for multiple simultaneous motor boards?
In flipping through the commit history for each branch, it appears the last updates were in early 2016. As best I can tell for that project as designed, it seems to have been the most active and thus perhaps the most likley to have the latest updates; apart individually inspecting each fork, though, I can't say for certain that it is the most advanced fork. Apparently the atanisoft fork activity declined due to that fork's maintainer focusing efforts on an ESP32 Command Station. The thread below has been ongoing since December 2017, but the website includes a high-level description, and there is also a GitHub project page. Website: https://atanisoft.github.io/ESP32CommandStation/ TrainBoard Thread: ESP32 Command Station GitHub Project: https://github.com/atanisoft/ESP32CommandStation More details are in the aforementioned thread than on the website, and I haven't been able to fully digest that entire thread yet, but RailCom support is planned (something I haven't seen yet in the Arduino implementations), and there have also been plans for a printed circuit board (check thread post 895 as well as posts within the last couple months).
I tried to use the bjorniuppsala fork, but he and/or Atanisoft have made major changes. Plus it is formatted for a different IDE instead of Arduino. I got started by putting it in a folder named DCCpp, renamed the DCCpp.cpp file to DCCpp.ino and tried to compile. It errors on "#include <atomic>" I changed the line to "#include <util/atomic.h>" and that at least gets past the error but then it fails on "#include <algorithm>". That looks like it is in the embedded template library. I downloaded that from my library manager in the Arduino IDE, but it installs in the wrong format. It just puts files in a bunch of subdirectories and gives tons of errors in the IDE of "Invalid Library" "no header .h files". I suppose I could find what I think are the right files and point to them, but there must be a "correct" way.
Based on the commits, I believe the IDE is PlatformIO. This article might be of help. Get started with Arduino and ESP32-DevKitC: debugging and unit testing
Thank you. I saw that he chose to use PlatformIO. I use RAD Studio (Delphi) and Visual Studio (VB and C#). For as little as I would ever use it, I was hoping to use the simple Arduino IDE that I know and use occasionally for all my other projects over the years and not have to install something else I have no hard drive space for and have to learn. I guess haveI to weigh how long it will take to see what libraries beyond the one I found so far this version added. The ETL library did not install the way it should for Arduino, but I can probably dig down into the folders and just copy the .h files up to the root folder where Arduino looks for them. I'll ask over on the esp thread if I can even do what I want to run this code on a Mega.
I'm a Visual Studio user, too, and I know VSCode isn't the same as Visual Studio, but there is this PlatformIO IDE plugin for VSCode.