Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.electronics.basics > #52711 > unrolled thread

Arduino code sources?

Started byTerry Pinnell <me@somewhere.invalid>
First post2019-05-31 11:48 +0100
Last post2019-06-02 23:40 -0400
Articles 20 on this page of 21 — 11 participants

Back to article view | Back to sci.electronics.basics


Contents

  Arduino code sources? Terry Pinnell <me@somewhere.invalid> - 2019-05-31 11:48 +0100
    Re: Arduino code sources? Cursitor Doom <curd@notformail.com> - 2019-05-31 11:40 +0000
      Re: Arduino code sources? terrypingm@gmail.com - 2019-05-31 05:57 -0700
        Re: Arduino code sources? Cursitor Doom <curd@notformail.com> - 2019-05-31 19:27 +0000
      Re: Arduino code sources? Peter Percival <peterxpercival@hotmail.com> - 2019-06-12 13:41 +0100
        Re: Arduino code sources? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-12 21:48 -0400
          Re: Arduino code sources? Peter Percival <peterxpercival@hotmail.com> - 2019-06-13 17:46 +0100
    Re: Arduino code sources? bitrex <user@example.net> - 2019-05-31 11:37 -0400
      Re: Arduino code sources? bitrex <user@example.net> - 2019-05-31 11:39 -0400
        Re: Arduino code sources? Terry Pinnell <me@somewhere.invalid> - 2019-05-31 18:13 +0100
    Re: Arduino code sources? Ralph Mowery <rmowery28146@earthlink.net> - 2019-05-31 15:07 -0400
    Re: Arduino code sources? Rheilly Phoull <rheilly@bigslong.com> - 2019-06-01 08:13 +0800
    Re: Arduino code sources? S Deyoreo <sdeyoreo@hotmail.com> - 2019-05-31 18:36 -0700
    Re: Arduino code sources? Terry Pinnell <me@somewhere.invalid> - 2019-06-01 11:45 +0100
      Re: Arduino code sources? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-06-01 12:36 +0100
        Re: Arduino code sources? Terry Pinnell <me@somewhere.invalid> - 2019-06-01 16:04 +0100
      Re: Arduino code sources? Ralph Mowery <rmowery28146@earthlink.net> - 2019-06-01 11:26 -0400
    Re: Arduino code sources? "Rodney Pont" <mlist4@infohit.me.uk> - 2019-06-01 15:11 +0100
      Re: Arduino code sources? Terry Pinnell <me@somewhere.invalid> - 2019-06-01 16:20 +0100
    Re: Arduino code sources? bitrex <user@example.net> - 2019-06-02 23:08 -0400
      Re: Arduino code sources? bitrex <user@example.net> - 2019-06-02 23:40 -0400

Page 1 of 2  [1] 2  Next page →


#52711 — Arduino code sources?

FromTerry Pinnell <me@somewhere.invalid>
Date2019-05-31 11:48 +0100
SubjectArduino code sources?
Message-ID<pg02fept12fd4h872f8jq590libopp4201@4ax.com>
I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super Starter kit)
and am stepping through its tutorials. In parallel I'm trying to learn the basics of
its C++ based programming language, but that's proving a struggle. I'm impatient to
use Arduino on my own projects so I will take a 'copy/paste/edit' approach. It then
becomes a matter of finding sketches that cover a particular subject and then
tailoring.

I'd therefore appreciate recommendations on Arduino sketch sources that others have
found useful please. 

Terry, East Grinstead, UK

[toc] | [next] | [standalone]


#52712

FromCursitor Doom <curd@notformail.com>
Date2019-05-31 11:40 +0000
Message-ID<qcr3ru$c53$1@dont-email.me>
In reply to#52711
On Fri, 31 May 2019 11:48:07 +0100, Terry Pinnell wrote:

> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super
> Starter kit) and am stepping through its tutorials. In parallel I'm
> trying to learn the basics of its C++ based programming language, but
> that's proving a struggle.

I wouldn't even bother with C++ in this instance. Get yourself a copy of 
Kernighan & Ritchie's the C Programming Language - the best book ever 
written on C.



-- 
This message may be freely reproduced without limit or charge only via 
the Usenet protocol. Reproduction in whole or part through other 
protocols, whether for profit or not, is conditional upon a charge of 
GBP10.00 per reproduction. Publication in this manner via non-Usenet 
protocols constitutes acceptance of this condition.

[toc] | [prev] | [next] | [standalone]


#52713

Fromterrypingm@gmail.com
Date2019-05-31 05:57 -0700
Message-ID<3af7e79e-7a41-43ac-8818-e9dd4a9f34cf@googlegroups.com>
In reply to#52712
Thanks. Arduino apparently uses C++, although the book I’m using, ‘Programming Arduino: (Second Edition)‘ by Simon Monks, mainly covers C. I gather that is adequate for relatively simple sketches.

Are you an Arduino user?

[toc] | [prev] | [next] | [standalone]


#52718

FromCursitor Doom <curd@notformail.com>
Date2019-05-31 19:27 +0000
Message-ID<qcrv68$j4m$1@dont-email.me>
In reply to#52713
On Fri, 31 May 2019 05:57:04 -0700, terrypingm wrote:

> Thanks. Arduino apparently uses C++, although the book I’m using,
> ‘Programming Arduino: (Second Edition)‘ by Simon Monks, mainly covers C.
> I gather that is adequate for relatively simple sketches.
> 
> Are you an Arduino user?

Yes, and indeed additionally a convert from the Pi, which has far too 
much video capability I don't need and don't wish to pay 3 times the 
price for.

I keep 3 or 4 Arduinos around in case I need one for a bespoke, embedded 
application which happens from time to time. They will repay the time 
invested in learning how they tick many, many, many times over. IMHO, 
they're a fantastic little board for the price.





-- 
This message may be freely reproduced without limit or charge only via 
the Usenet protocol. Reproduction in whole or part through other 
protocols, whether for profit or not, is conditional upon a charge of 
GBP10.00 per reproduction. Publication in this manner via non-Usenet 
protocols constitutes acceptance of this condition.

[toc] | [prev] | [next] | [standalone]


#52801

FromPeter Percival <peterxpercival@hotmail.com>
Date2019-06-12 13:41 +0100
Message-ID<qdqrto$rtj$1@news.albasani.net>
In reply to#52712
Cursitor Doom wrote:
> On Fri, 31 May 2019 11:48:07 +0100, Terry Pinnell wrote:
> 
>> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super
>> Starter kit) and am stepping through its tutorials. In parallel I'm
>> trying to learn the basics of its C++ based programming language, but
>> that's proving a struggle.
> 
> I wouldn't even bother with C++ in this instance. Get yourself a copy of
> Kernighan & Ritchie's the C Programming Language - the best book ever
> written on C.

And Harbison and Steele as number two.


-- 
"He who will not reason is a bigot;
he who cannot is a fool;
he who dares not is a slave."
  - Sir William Drummond

[toc] | [prev] | [next] | [standalone]


#52802

FromPhil Hobbs <pcdhSpamMeSenseless@electrooptical.net>
Date2019-06-12 21:48 -0400
Message-ID<s4KdnVm8Vr_zNpzAnZ2dnUU7-IvNnZ2d@supernews.com>
In reply to#52801
On 6/12/19 8:41 AM, Peter Percival wrote:
> Cursitor Doom wrote:
>> On Fri, 31 May 2019 11:48:07 +0100, Terry Pinnell wrote:
>>
>>> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super
>>> Starter kit) and am stepping through its tutorials. In parallel I'm
>>> trying to learn the basics of its C++ based programming language, but
>>> that's proving a struggle.
>>
>> I wouldn't even bother with C++ in this instance. Get yourself a copy of
>> Kernighan & Ritchie's the C Programming Language - the best book ever
>> written on C.

Agreed.  My son taught himself C out of K&R just a few years back, and 
liked it very well.

> 
> And Harbison and Steele as number two.
> 
> 

H&S was an excellent book, and I used it for several years.  However, 
time has moved on, and the old-time C libraries are showing their age. 
I still used <cstdio>, but stuff like strdup() and realloc()?  Really?

Cheers

Phil Hobbs

-- 
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC / Hobbs ElectroOptics
Optics, Electro-optics, Photonics, Analog Electronics
Briarcliff Manor NY 10510

http://electrooptical.net
http://hobbs-eo.com

[toc] | [prev] | [next] | [standalone]


#52803

FromPeter Percival <peterxpercival@hotmail.com>
Date2019-06-13 17:46 +0100
Message-ID<qdtul4$jis$1@news.albasani.net>
In reply to#52802
Phil Hobbs wrote:
> On 6/12/19 8:41 AM, Peter Percival wrote:
>> Cursitor Doom wrote:
>>> On Fri, 31 May 2019 11:48:07 +0100, Terry Pinnell wrote:
>>>
>>>> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super
>>>> Starter kit) and am stepping through its tutorials. In parallel I'm
>>>> trying to learn the basics of its C++ based programming language, but
>>>> that's proving a struggle.
>>>
>>> I wouldn't even bother with C++ in this instance. Get yourself a copy of
>>> Kernighan & Ritchie's the C Programming Language - the best book ever
>>> written on C.
> 
> Agreed.  My son taught himself C out of K&R just a few years back, and 
> liked it very well.
> 
>>
>> And Harbison and Steele as number two.
>>
>>
> 
> H&S was an excellent book, and I used it for several years.  However, 
> time has moved on, and the old-time C libraries are showing their age. I 
> still used <cstdio>, but stuff like strdup() and realloc()?  Really?
> 
> Cheers
> 
> Phil Hobbs
> 

I confess, I haven't programmed in anger for thirteen years or more, so 
anything I say is probably well out of date!

-- 
"He who will not reason is a bigot;
he who cannot is a fool;
he who dares not is a slave."
  - Sir William Drummond

[toc] | [prev] | [next] | [standalone]


#52714

Frombitrex <user@example.net>
Date2019-05-31 11:37 -0400
Message-ID<xSbIE.11877$h55.1449@fx41.iad>
In reply to#52711
On 5/31/19 6:48 AM, Terry Pinnell wrote:
> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super Starter kit)
> and am stepping through its tutorials. In parallel I'm trying to learn the basics of
> its C++ based programming language, but that's proving a struggle. I'm impatient to
> use Arduino on my own projects so I will take a 'copy/paste/edit' approach. It then
> becomes a matter of finding sketches that cover a particular subject and then
> tailoring.
> 
> I'd therefore appreciate recommendations on Arduino sketch sources that others have
> found useful please.
> 
> Terry, East Grinstead, UK
> 

Best place to start looking is the library search function from the IDE 
itself, Sketch -> Include Libraries -> Manage Libraries or control + 
shift + I.

 From there you can search for libraries covering a lot of common 
embedded hardware devices and software tasks. Most will have links to a 
repository of the source code for how they're implemented (some are more 
complicated than others.)

[toc] | [prev] | [next] | [standalone]


#52715

Frombitrex <user@example.net>
Date2019-05-31 11:39 -0400
Message-ID<xUbIE.11987$h55.4818@fx41.iad>
In reply to#52714
On 5/31/19 11:37 AM, bitrex wrote:
> On 5/31/19 6:48 AM, Terry Pinnell wrote:
>> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super 
>> Starter kit)
>> and am stepping through its tutorials. In parallel I'm trying to learn 
>> the basics of
>> its C++ based programming language, but that's proving a struggle. I'm 
>> impatient to
>> use Arduino on my own projects so I will take a 'copy/paste/edit' 
>> approach. It then
>> becomes a matter of finding sketches that cover a particular subject 
>> and then
>> tailoring.
>>
>> I'd therefore appreciate recommendations on Arduino sketch sources 
>> that others have
>> found useful please.
>>
>> Terry, East Grinstead, UK
>>
> 
> Best place to start looking is the library search function from the IDE 
> itself, Sketch -> Include Libraries -> Manage Libraries or control + 
> shift + I.
> 
>  From there you can search for libraries covering a lot of common 
> embedded hardware devices and software tasks. Most will have links to a 
> repository of the source code for how they're implemented (some are more 
> complicated than others.)

The repos for most libraries will also contain example code to show how 
they should be used in practice.

[toc] | [prev] | [next] | [standalone]


#52716

FromTerry Pinnell <me@somewhere.invalid>
Date2019-05-31 18:13 +0100
Message-ID<j5o2fe93cutk7a18o7jknqk9nk19cpq19i@4ax.com>
In reply to#52715
bitrex <user@example.net> wrote:

>On 5/31/19 11:37 AM, bitrex wrote:
>> On 5/31/19 6:48 AM, Terry Pinnell wrote:
>>> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super 
>>> Starter kit)
>>> and am stepping through its tutorials. In parallel I'm trying to learn 
>>> the basics of
>>> its C++ based programming language, but that's proving a struggle. I'm 
>>> impatient to
>>> use Arduino on my own projects so I will take a 'copy/paste/edit' 
>>> approach. It then
>>> becomes a matter of finding sketches that cover a particular subject 
>>> and then
>>> tailoring.
>>>
>>> I'd therefore appreciate recommendations on Arduino sketch sources 
>>> that others have
>>> found useful please.
>>>
>>> Terry, East Grinstead, UK
>>>
>> 
>> Best place to start looking is the library search function from the IDE 
>> itself, Sketch -> Include Libraries -> Manage Libraries or control + 
>> shift + I.
>> 
>>  From there you can search for libraries covering a lot of common 
>> embedded hardware devices and software tasks. Most will have links to a 
>> repository of the source code for how they're implemented (some are more 
>> complicated than others.)
>
>The repos for most libraries will also contain example code to show how 
>they should be used in practice.

Thanks, I'll start there.

Terry, East Grinstead, UK

[toc] | [prev] | [next] | [standalone]


#52717

FromRalph Mowery <rmowery28146@earthlink.net>
Date2019-05-31 15:07 -0400
Message-ID<MPG.375b34366cd11b04989a2d@news.east.earthlink.net>
In reply to#52711
In article <pg02fept12fd4h872f8jq590libopp4201@4ax.com>, 
me@somewhere.invalid says...
> 
> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super Starter kit)
> and am stepping through its tutorials. In parallel I'm trying to learn the basics of
> its C++ based programming language, but that's proving a struggle. I'm impatient to
> use Arduino on my own projects so I will take a 'copy/paste/edit' approach. It then
> becomes a matter of finding sketches that cover a particular subject and then
> tailoring.
> 
> I'd therefore appreciate recommendations on Arduino sketch sources that others have
> found useful please. 
> 
> Terry, East Grinstead, UK
> 
> 

You may want to start here:
https://www.arduino.cc/en/Guide/HomePage

Here is another place that shows how to hook up many of the sensors.

https://www.sunfounder.com/learn/category/Sensor-Kit-v2-0-for-
Arduino.html

There are lots of people on youtube that have done many things with the 
Arduino.  I have been playing with them for about 2 years.  The language 
is simple, but I am not a programmer.  I do it like I do the game of 
chess.  I know how each piece moves on the board, but playing someone 
that has a basic understanding of the game will beat me in a very short 
time.  I can make simple changes to other's programs but that is it.

[toc] | [prev] | [next] | [standalone]


#52719

FromRheilly Phoull <rheilly@bigslong.com>
Date2019-06-01 08:13 +0800
Message-ID<77ydnRnBe5WxXmzBnZ2dnUU7-emdnZ2d@westnet.com.au>
In reply to#52711
On 31/05/2019 6:48 pm, Terry Pinnell wrote:
> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super Starter kit)
> and am stepping through its tutorials. In parallel I'm trying to learn the basics of
> its C++ based programming language, but that's proving a struggle. I'm impatient to
> use Arduino on my own projects so I will take a 'copy/paste/edit' approach. It then
> becomes a matter of finding sketches that cover a particular subject and then
> tailoring.
> 
> I'd therefore appreciate recommendations on Arduino sketch sources that others have
> found useful please.
> 
> Terry, East Grinstead, UK
> 

There are heaps of sites around courtesy of mr google :-)
Try 
<https://www.deviceplus.com/?utm_source=google&utm_campaign=arduino&utm_medium=ppc> 
as a starter.

[toc] | [prev] | [next] | [standalone]


#52720

FromS Deyoreo <sdeyoreo@hotmail.com>
Date2019-05-31 18:36 -0700
Message-ID<e9df44a2-ab16-4457-a664-1614a84e43bd@googlegroups.com>
In reply to#52711
On Friday, May 31, 2019 at 6:48:11 AM UTC-4, Terry Pinnell wrote:
> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super Starter kit)
> and am stepping through its tutorials. In parallel I'm trying to learn the basics of
> its C++ based programming language, but that's proving a struggle. I'm impatient to
> use Arduino on my own projects so I will take a 'copy/paste/edit' approach. It then
> becomes a matter of finding sketches that cover a particular subject and then
> tailoring.
> 
> I'd therefore appreciate recommendations on Arduino sketch sources that others have
> found useful please. 
> 
> Terry, East Grinstead, UK

I have a crap load. Anything in particular you want to see?

[toc] | [prev] | [next] | [standalone]


#52721

FromTerry Pinnell <me@somewhere.invalid>
Date2019-06-01 11:45 +0100
Message-ID<m3k4fehhjs1tmpfastpovp5ph515ecfvdo@4ax.com>
In reply to#52711
Terry Pinnell <me@somewhere.invalid> wrote:

>I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super Starter kit)
>and am stepping through its tutorials. In parallel I'm trying to learn the basics of
>its C++ based programming language, but that's proving a struggle. I'm impatient to
>use Arduino on my own projects so I will take a 'copy/paste/edit' approach. It then
>becomes a matter of finding sketches that cover a particular subject and then
>tailoring.
>
>I'd therefore appreciate recommendations on Arduino sketch sources that others have
>found useful please. 
>
>Terry, East Grinstead, UK

Thanks to those who suggested useful sources of code, a couple of which I've added
to my already extensive 'Arduino Code' bookmarks.

As per my opening post, I am already stepping through the Elegoo tutorials, some 37
projects. And dipping in and out of two other sets.

As also explained, I don't want to master either C or C++. I want to reach the stage
I described: minimal competence for a copy/paste/edit approach.

I'm seeking feedback from other Arduino users on the sources they've found most
useful to find sketch code to help them with a specific project or section of one. 

My current sources apart from tutorial projects are the obvious Google Search, the
Arduino Forum, and the Embedded Systems and Micro controllers section of the All
About Circuits Forum.

Unless there's a superbly indexed site I haven't yet found, perhaps that's enough.

Terry, East Grinstead, UK 

[toc] | [prev] | [next] | [standalone]


#52722

FromTom Gardner <spamjunk@blueyonder.co.uk>
Date2019-06-01 12:36 +0100
Message-ID<krtIE.535211$6s.178703@fx39.am4>
In reply to#52721
On 01/06/19 11:45, Terry Pinnell wrote:
> Unless there's a superbly indexed site I haven't yet found, perhaps that's enough.

There is such a site, with wonderful indexes. It is
called google, and knowing how to use it effectively
is a key modern skill.

It isn't difficult; my 10yo quickly mastered it
sufficiently that she demolished my arguments about
why we shouldn't get chickens. Made me proud, and
glad to get them.

[toc] | [prev] | [next] | [standalone]


#52724

FromTerry Pinnell <me@somewhere.invalid>
Date2019-06-01 16:04 +0100
Message-ID<bu45fe11dnuar98b98ej0hdki2li2arg75@4ax.com>
In reply to#52722
Tom Gardner <spamjunk@blueyonder.co.uk> wrote:

>On 01/06/19 11:45, Terry Pinnell wrote:
>> Unless there's a superbly indexed site I haven't yet found, perhaps that's enough.
>
>There is such a site, with wonderful indexes. It is
>called google, and knowing how to use it effectively
>is a key modern skill.
>
>It isn't difficult; my 10yo quickly mastered it
>sufficiently that she demolished my arguments about
>why we shouldn't get chickens. Made me proud, and
>glad to get them.

That's why it was the first of the three I listed.

Terry Pinnell, East Grinstead, UK

[toc] | [prev] | [next] | [standalone]


#52727

FromRalph Mowery <rmowery28146@earthlink.net>
Date2019-06-01 11:26 -0400
Message-ID<MPG.375c631811a7ca56989a2f@news.east.earthlink.net>
In reply to#52721
In article <m3k4fehhjs1tmpfastpovp5ph515ecfvdo@4ax.com>, 
me@somewhere.invalid says...
> 
> My current sources apart from tutorial projects are the obvious Google Search, the
> Arduino Forum, and the Embedded Systems and Micro controllers section of the All
> About Circuits Forum.
> 
> 
> 

I found this most helpful.  It is a list of the commands and short 
explination.  Near the end there are some short examples of the 
commands.

https://archive.org/details/arduino_notebook

[toc] | [prev] | [next] | [standalone]


#52723

From"Rodney Pont" <mlist4@infohit.me.uk>
Date2019-06-01 15:11 +0100
Message-ID<nfcnzbgcqvasbuvgzrhx.psfpay0.pminews@ouse.infohit.me.uk>
In reply to#52711
On Fri, 31 May 2019 11:48:07 +0100, Terry Pinnell wrote:

>I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super Starter kit)
>and am stepping through its tutorials. In parallel I'm trying to learn the basics of
>its C++ based programming language, but that's proving a struggle. I'm impatient to
>use Arduino on my own projects so I will take a 'copy/paste/edit' approach. It then
>becomes a matter of finding sketches that cover a particular subject and then
>tailoring.
>
>I'd therefore appreciate recommendations on Arduino sketch sources that others have
>found useful please. 

I found books easier to get on with than on screen things but I'm an
oldie and a long term programmer.

Arduino for Dummies is good for getting used to Arduino with worked
examples.

Arduino Cookbook published by O'Reilly is also very good and goes into
programming techniques such as loops, decision structures and variable
types. I presume those would be useful to a started in programming. It
states the problem (such as You want to send text and data from your
Arduino to your pc) and then shows a solution.

-- 
Regards - Rodney Pont
The from address exists but is mostly dumped,
please send any emails to the address below
e-mail	rpont (at) gmail (dot) com

[toc] | [prev] | [next] | [standalone]


#52726

FromTerry Pinnell <me@somewhere.invalid>
Date2019-06-01 16:20 +0100
Message-ID<d255fed34un6g7bsjfas0q8l9emc8k0fft@4ax.com>
In reply to#52723
"Rodney Pont" <mlist4@infohit.me.uk> wrote:

>On Fri, 31 May 2019 11:48:07 +0100, Terry Pinnell wrote:
>
>>I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super Starter kit)
>>and am stepping through its tutorials. In parallel I'm trying to learn the basics of
>>its C++ based programming language, but that's proving a struggle. I'm impatient to
>>use Arduino on my own projects so I will take a 'copy/paste/edit' approach. It then
>>becomes a matter of finding sketches that cover a particular subject and then
>>tailoring.
>>
>>I'd therefore appreciate recommendations on Arduino sketch sources that others have
>>found useful please. 
>
>I found books easier to get on with than on screen things
Me too.

>but I'm an oldie
Me too.

>and a long term programmer.
Not me.

I'm currently ploughing through Simon Monk's 'Programming Arduino, 2nd Edition'.
Quite readable up to his first complex example, flashing Morse code to the LED from
the serial monitor), mainly because of its use of arrays within arrays ;-(

>
>Arduino for Dummies is good for getting used to Arduino with worked
>examples.

Went straight to your next recommendation as I hope Monk's book and the online
tutorials I'm studying will get me to a stage I can benefit from the Margolis.

>Arduino Cookbook published by O'Reilly is also very good and goes into
>programming techniques such as loops, decision structures and variable
>types.
Looks good, although pretty expensive at £24 (~ $30), but have just ordered.

>I presume those would be useful to a started in programming. It
>states the problem (such as You want to send text and data from your
>Arduino to your pc) and then shows a solution.

Thanks, appreciated.

Terry, East Grinstead, UK

[toc] | [prev] | [next] | [standalone]


#52731

Frombitrex <user@example.net>
Date2019-06-02 23:08 -0400
Message-ID<Ba0JE.47897$NT5.9760@fx47.iad>
In reply to#52711
On 5/31/19 6:48 AM, Terry Pinnell wrote:
> I bought my first Arduino UNO R3 kit two weeks ago (the Elegoo Super Starter kit)
> and am stepping through its tutorials. In parallel I'm trying to learn the basics of
> its C++ based programming language, but that's proving a struggle. I'm impatient to
> use Arduino on my own projects so I will take a 'copy/paste/edit' approach. It then
> becomes a matter of finding sketches that cover a particular subject and then
> tailoring.
> 
> I'd therefore appreciate recommendations on Arduino sketch sources that others have
> found useful please.
> 
> Terry, East Grinstead, UK
> 

A "modern C++" feature that would be very helpful for uP based projects 
is a smart pointer. You can't really do dynamic memory 
allocation/de-allocation at will on a processor with 2k of RAM. But you 
still often need to hold and transfer resources around.

What's a pointer? A pointer holds the address of a _resource_. The 
ownership status of a resource must always be well-defined. A "unique 
pointer" object defines ownership of a resource - the object that holds 
that unique pointer object, which wraps a dumb pointer, "owns" that 
resource. Unique pointers cant be copied, only moved. If an object holds 
a unique pointer it cannot be copied, either, or else two owners would 
exist. Nuh uh.

Sometimes other code needs to hold a reference to a resource. Some logic 
would like to see what a data buffer contains, but shouldn't "own" the 
buffer. So there can be an "observer pointer". It can only be used for 
read-only access to the resource but cannot modify the actual resource's 
state in any way. The observer container can be both copied and moved. 
They can be passed to functions, even plain-C functions, taking a 
const-qualified raw pointer seamlessly but cannot be passed to functions 
taking a non-const qualified pointer as that would allow write access to 
the resource.

An advantage of C++ is you can write code to define rule-enforcing data 
structures like that to, by design, self-enforce safer further design 
decisions. Along the same lines raw data types like "int" should never 
be used and passed around to represent something like dollars in a bank 
account, or velocity. They should be wrapped in an object that enforces 
assumptions like class Dollars, or class Velocity. A function that 
computes an output velocity from an input velocity should return a 
Velocity and take a Velocity argument e.g. Velocity 
calc_new_velocity(Velocity v) not int calc_new_velocity(int v).

And no, this almost never "bloats the code" if done intelligently the 
compiler and optimizer will figure out that in almost all cases it can 
compute a velocity under the hood by just manipulating the raw ints like 
it would when compiling C. all the boilerplate is mostly for your 
benefit so it can warn you if you try to do something stupid.

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | sci.electronics.basics


csiph-web