1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Other need a bit of help from a programming language

Discussion in 'Tech Support' started by dave_c, 16 Aug 2014.

  1. dave_c

    dave_c Minimodder

    Joined:
    31 Jul 2009
    Posts:
    436
    Likes Received:
    11
    As all the tech heads are likely to be in here thought this would be the right place to ask :)

    im trying to learn computer programming (self taught). i want to learn for robotics. a friend has suggested that i start with C# so at the moment thats what im going to do. i dont want to bug him with too many questions so thought i would ask here.

    once im fairly proficient with C# should i then move onto C or C++ or some alternative? i want to be able to do things from the base up and make some fairly advanced robots. any help is appreciated.

    Also im starting with the "for dummies" books but if anyone could suggest any alternatives i would really appreciate it.

    thanks in advance.
     
  2. theshadow2001

    theshadow2001 [DELETE] means [DELETE]

    Joined:
    3 May 2012
    Posts:
    5,284
    Likes Received:
    183
    This topic would probably be more appropriate in the General section as you don't have anything that requires tech support (just yet)

    When I think hobby robotics I think Arduinos and Raspberry PIs. In the case of those devices as a programming language, C++ makes a little more sense.

    In my mind C# is more for desktop applications for windows. C# makes doing things like using windows forms to create a GUI based application a bit easier than C or C++. In fact it makes a lot of things easier like database interaction, network comms etc. etc.

    However, your goal is to interact with things like motors, encoders, get feedback from sensors not necessarily make windows applications. So you'll probably have to learn the C like language of the Arduino, or C/C++ or python to use a raspberry pi.

    So my final bit of advice is, go do your research on the robotics end. See what hardware people are using. Choose your hardware and from there, choosing an appropriate programming language will be fairly straight forward.

    That being said there could be some robotics kit that has a C# api. But like I said, choose the hardware then the language.

    Also don't pay too much attention to your friend, C# overall is probably an easier language but the basics of all languages are fairly reasonable to learn. Its when you get into the complex ideas, and larger programs that the difficulties and the nuances come into play. If you're starting with robotics its unlikely you will come up against those challenges straight away (or at all). There's no point in learning a language only to have to start all over again just to accomplish your original goal.
     
    Last edited: 16 Aug 2014
  3. Beasteh

    Beasteh What's a Dremel?

    Joined:
    18 Feb 2012
    Posts:
    278
    Likes Received:
    10
    Honestly, for learning the basics, it doesn't matter too much as the syntax is largely the same between the three.

    If you're going to use the Arduino, it uses Processing, which is like C but not. Best place to start would be to find out what you'd like to build, then work out what you need to learn to make that happen (what theshadow2001 said).

    I'd suggest starting with C, but that's my embedded bias kicking in. Web or GUI developers wouldn't recommend plain C.

    Good books? How about free books? https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md
     
  4. dave_c

    dave_c Minimodder

    Joined:
    31 Jul 2009
    Posts:
    436
    Likes Received:
    11
    He said i need to understand code and structure before syntax. Hes generally VERY well clued up on this stuff and is a teacher on the subject.
     
  5. theshadow2001

    theshadow2001 [DELETE] means [DELETE]

    Joined:
    3 May 2012
    Posts:
    5,284
    Likes Received:
    183
    Good old academics always living in the real world :rolleyes: Understanding poylmorphism and class abstraction won't make your robot move an inch.

    (For the record I'm an engineer that has programmed production lines for factories, using code to make hardware move is my bread and butter)
     
    Last edited: 16 Aug 2014
  6. dave_c

    dave_c Minimodder

    Joined:
    31 Jul 2009
    Posts:
    436
    Likes Received:
    11
    Sorry shadow. Didnt mean to sound like im putting down your opinion. Ill be honest NO idea what polymorphism or abstract what-ja-ma-call-its :D

    I waa thinking more of learning c# as something to get menin the mind set more than anything. Ive tried to learn before and was atarted on C. My brain basically crashed :)
     
  7. theshadow2001

    theshadow2001 [DELETE] means [DELETE]

    Joined:
    3 May 2012
    Posts:
    5,284
    Likes Received:
    183
    I'm not offended dude, its just that talking to the guy that's good at coding isn't necessarily the guy to talk to about robots.

    Robotics is such a wide scope field.

    You have mechanical elements - the robots design - how it will physically do what it needs to do, gearing mechanisms, how do I add tools like grippers or other actuators.

    You have electronic and electrical elements. - What motors do I use, how do I interface the motors to a controller, how do I read the position of the robot, how do I add sensors?

    You have the controller - How do I make it to do the sequence that I want. How can I make the robot see objects, how do I make the robot not crash into itself or something else.

    The programming is only one small part of a much broader field.

    If your brain melted down whilst learning C, then learning any other language by the same means is not going to be much different. That is not a statement meant to discourage you, it just means that you need to find a different approach. Don't think that by simply switching languages everything will suddenly become easier.


    Look at the following:


    The code behind this robot is incredibly simple. The complexity arises in putting all the elements of the robot together. Learning C# so that you can then start to learn the C like arduino language doesn't really make sense, just to build something like the above. Learning any programming language doesn't tell you how to connect the motor to the arduino.

    There's got to be lots or noob friendly arduino sites, communities and tutorials out there. Just buy some kit and get stuck in man! If you're having difficulty there are plenty of people out there that can help you out. Pick a small basic project. Get it set up and going. Then modify it, be it the controlling code, the mechanical end of it, the electrical. It doesn't really matter. Make it do something different. Then build on the knowledge you have gained to do something else. Maybe add more elements to the robot or try something completely different.

    Above all else, you have to start small and you don't need to understand everything right away. You don't need to understand everything to even begin or get something up and running. As you progress and experiment the understanding will come.
     
    Last edited: 16 Aug 2014
  8. davidbrown1988

    davidbrown1988 Minimodder

    Joined:
    8 Mar 2008
    Posts:
    154
    Likes Received:
    4
    When I started programming (ignoring assembly and drawing out logic gates) I started with C++.

    Once I had a thorough understanding of the one language I found it easy to move onto C# and from there any other language.

    Most of learning how to program is like learning a spoken language. It’s not about the context or the functions used but how the listener is going to try to interpret what you are saying so that you can word your message in the correct way for it to be understood. Most languages all use a similar structure even if the syntax is different and so once one language has been learnt changing to a new language is simply about learning the syntax. I'm guessing this was what your friend was trying to point out.

    For resources I would check out here for a start if considering the basics of C / C++: http://www.w3schools.in/cplusplus/
     
  9. dynamis_dk

    dynamis_dk Grr... Grumpy!!

    Joined:
    23 Nov 2005
    Posts:
    3,762
    Likes Received:
    339
    Personally I would start to find small project which bridge the gap between the electronics side and coding. Don't make the mistake of taking all the fun out of it by putting too much focus on coding. Everyone is different obviously but I found the easiest way to learn coding was to find little project that interest you and build up knowledge in blocks.

    Like shadow says above - get stuck in! The coding experience will build so much faster if your having fun while learning :)
     

Share This Page