Arduino &c for dinosaurs

Advert

Arduino &c for dinosaurs

Home Forums Electronics in the Workshop Arduino &c for dinosaurs

Viewing 6 posts - 26 through 31 (of 31 total)
  • Author
    Posts
  • #310164
    I.M. OUTAHERE
    Participant
      @i-m-outahere

      You can break most things up :

      Global variables ,setup and your loop .

      So i think Brian has hit the nail on the head for beginners , work on a section at a time on paper then once you're happy punch it into the IDE and see if it compiles .

      Advert
      #310190
      SillyOldDuffer
      Moderator
        @sillyoldduffer
        Posted by Thomas Staubo on 02/08/2017 15:44:57:

        The programming is the hard part for me. You can say it's greek to me.

        Electronics I can manage far better. I searched for "Arduino GUI" to see if there's an easier way. And there seems to be several GUI based programs, but I don't know if it's something for serious use, or if it's just for kids use.

        Anybody tried something like that??

        I've played a little with Ardublock and am in two minds about it. In some ways it simplifies, in others it obstructs!

        If I were running a course I'd happily use Ardublock to introduce learners to structured programming and to Arduino basic concepts. The block sketches could be projected on the wall and a teacher could explain what it does quite easily. A few questions and answers and the class would 'get it'. I'm much less sure about recommending Ardublock to a self-learning beginner. Although the tool hides the need to learn 'C' syntax, editing and compile/upload, you still have to understand Ardublock Semantics and program design. In my experience, the hardest part of programming is design and understanding what the computer language means so you can implement the design. I couldn't find a Reference or a good set of Tutorials for that aspect of Ardublock.

        The biggest objection though is that Ardublock is limited compared with writing a Sketch with the Arduino IDE. The IDE has a complete language and can create and call libraries etc. For example, when using serial I/O, it's usual to set the baud rate in setup(). Ardublock doesn't appear to support that simple requirement; it assumes that the default settings will be fine. That's OK in classroom, but not in the real world.

        The easiest way to get into Arduino is to buy a starter set (any of them will do,) and to download the Arduino environment. It comes with many examples and comprehensive reference material. Also, because it uses a fairly complete C/C++ compiler most online C/C++ documentation and books will makes sense. There are many Arduino specific books; the main variation being what you intend to connect to the Arduino, and the sophistication of your interest. (Basic electronics, Ham Radio , Robots, Sensors, machine control etc.)

        You have to be a little wary programming the Arduino. Not everything is implemented because it's a tiny computer. Annoyingly, Arduino sprintf() doesn't implement string formatting because the resulting big program won't fit on an Arduino. On the other hand, the PC-based compiler is pretty much full strength so smarty-pants can still use 'advanced' features like C++ Templates.

        The important thing is to get stuck in. Fretting about being a dinosaur doesn't help. Give it a try and see how you get on. There are plenty of people who can answer questions and the worst that can happen is you waste a few quid. Don't be embarrassed if you find it's not your cup of tea: many clever people hate computers!

        Dave

        #310278
        Robin Graham
        Participant
          @robingraham42208
          Posted by Neil Wyatt on 02/08/2017 16:40:49:

          Posted by Robin Graham on 01/08/2017 23:17:20:

          As computing has evolved, layers upon layers of abstraction have covered up what's 'actually' going on. That makes it easier for some folk, but harder for a dinosaur like me.

          In that case, you might enjoy programming arduinos (well the AVR chips on them) in AVR assembler. No nasty abstractions to spoil the experience and hugely powerful chips!

          Neil

          Arf! I might well Neil! I'm not actually waging a war against 'nasty' (not my word!) abstractions. I confess that I might have made use of printf on odd occasions. Coding a big program like Microsoft Word, for example, in pure machine language or even assembler would have perhaps been impossible , and we certainly would have been deprived of life-enhancing features like the paperclip. Or this thing which substitutes 'this' when I type 'that'. Because it knows better. But on the other hand, if you had to code this sort of nonsense in assembler – well, you'd think twice about it wouldn't you? And worry about bloat?

          I've steered the abstraction of my finger to the OneClick 'button' on the Amazon offering which Jouneyman John recommended, so expecting a parcel tomorrow. As (not so Silly)OldDuffer says, best to just dive in and see what happens.

          For those finding the C language confusing, I would recommend Kernighan and Ritchie. It's an old book now, but it it explains very clearly how the syntax works  – as you might expect from the chap who made it up.

          Thanks again for advice, Robin

          Edited By Robin Graham on 04/08/2017 00:09:54

          #310319
          Russell Eberhardt
          Participant
            @russelleberhardt48058

            One thing I don't like about the C language is that if you misspell or miss-type the name of a variable the compiler doesn't flag an error but assumes a new variable and your program will have a bug which can be difficult to find. When I started programming in the 1960s with Algol you had to declare all variables at the start of the program (or subroutine) and any undeclared variables were flagged by the compiler.

            Russell

            #310323
            duncan webster 1
            Participant
              @duncanwebster1

              with the IDE/compiler I use (CodeBlocks) I declare variables at the start, if I try to use one which hasn't been declared it throws a hissy fit. You can declare them as in the body of the prgram, but you have to tell it what type eg

              int eric = 4;

              I don't like this, but it's a style issue.

              #310325
              SillyOldDuffer
              Moderator
                @sillyoldduffer
                Posted by Russell Eberhardt on 04/08/2017 11:23:57:

                One thing I don't like about the C language is that if you misspell or miss-type the name of a variable the compiler doesn't flag an error but assumes a new variable and your program will have a bug which can be difficult to find. When I started programming in the 1960s with Algol you had to declare all variables at the start of the program (or subroutine) and any undeclared variables were flagged by the compiler.

                Russell

                Many languages do that Russell but 'C' isn't one of them. C was much influenced by ALGOL including making it essential to declare variables up front.

                One circumstance that might create your 'no error' symptom in C is when compiling a module. (A module is a separate compilation unit that will be linked into the main program later. ) Finding an undeclared variable inside a module the compiler might assume that the variable has been declared in another module, which it doesn't know about.

                The last stage of the compilation process is to call a linker to glue all the parts together. If the variable isn't defined in any of the parts, a link error will be thrown. Quite likely the error message output by the linker will be unhelpful and, until you've twigged it, might be mistaken for a difficult to find bug.

                I have fond memories of Algol60 – much cleaner than contemporary COBOL, FORTRAN and BASIC. It was primitive though; weird input-output, and I don't think it supported modules at all.

                Dave

              Viewing 6 posts - 26 through 31 (of 31 total)
              • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

              Advert

              Latest Replies

              Viewing 25 topics - 1 through 25 (of 25 total)
              Viewing 25 topics - 1 through 25 (of 25 total)

              View full reply list.

              Advert

              Newsletter Sign-up