Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Status of my servo controller project

4557 views
31 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Saturday, September 22, 2018 9:57 PM

 BTW, i DO understand the concept of creating an array of STRUCT for the various variables, then each Metroo call would be like chkbutton(1) or chkbutton(2), or moveservo(1), moveservo(2), etc. and yes, if I expanded to 12 servers, I would just have to change my array declaration to 12 and bingo, now it runs 12 (well, there's have to be some setting of the pin definitions in there - for the inputs and the outputs). Is that more proper by OOP standards? Probably. Is it easier for someone who doesn't know these things to figure out? Probably not. Famous last workds "It will never grow beyond this" but - it won't.  The smaller chips are cheaper, because they are used in dime a dozen Arduinos, and the bigger ones with more I/O either aren't fully capable in a PDIP package, or just plain aren't available. So in this case it's true, i will never design one that could use the same code but drive 6 servos, or something like that. At this point, I am almost willing to say I will NEVER use SMD components (except as resistors for resistor wheelsets - and possibly LEDs for loco lighting) because I simply can not see well enough to work with the tiny stuff, magnifiers or not. Wider pitch things, I probably could drag colder. But the finer stuff? I'm not going to invest in a board assembly microsofpe, or a reflow oven. ANd BGA parts - forget about it, that is NOT a DIY thing. Those "Fix your video card" YouTube videos - yeah, they are kidding themselves if they thing they are truly reflowing all the balls under that GPU. Plus - I'd rather not run long runs of servo cable everywhere, and 2 is a nice number because it works for a crossover. I went through this over and over - the idea that if I eliminated the remote control (which isn't needed for a ayrd) I could add a third servo - but I fall a couple of pins short, even with the single relay method. So si settled on a standard board that will drive 2 servos, asosciated LEDs and switches, and have a remote control option. In fact I MIGHT use the remote input to drive the yard ones using an input matrix for route controol, instead of 2 buttons for every turnout. But I figured if I designed all kinds of different boards for every special conditioon on the layout, I'd spend all my time designing hardware and not building a layout. So - one standard board, the same everywhere, no mucking with special conditions everywhere.

                                      --Randy


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Sunday, September 23, 2018 5:52 AM

randy

PM me if your interested in discussing this.   i'd really like to see you post code that is more readable and reusable by others.

BTW, object oriented coding can be done in many languages, including assembly.  C is no exception.

greg

greg - Philadelphia & Reading / Reading

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!