Go Down

Topic: Library to help beginners! (Read 2122 times) previous topic - next topic

TomasRoj

Hey coders, geeks and tech fans,

It would be good to have all in one library that conatins many examples for beginners. And all what they would do is to call a method. Blinking, servo turning or anything else! Good news - I am creating one and version 1.0. is already availibe in the arduino library manager.

But i need your help,
I am telling everyone here: Please contribute and together we can build better start for arduino beginners!

With friendly access, we can build something amazing!
Start your adventure here: https://github.com/TomasRoj/BasicsLibrary

Hope you are having good day,
Tom

J-M-L

It would be good to have all in one library that contains many examples for beginners.
why would that be better than having multiple library, each with examples that let you understand exactly that library?  I'm not convinced.
Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

Robin2

#2
Mar 30, 2019, 05:10 pm Last Edit: Mar 30, 2019, 05:11 pm by Robin2
IMHO for your library to be more useful to beginners than the existing libraries it needs to have detailed documentation for each function which clearly identifies their usage, scope and limitations.

Few things are as frustrating for a beginner as trying to use a function for something it is not capable of when there is nothing to make that clear.


I must say my own preference lies with @J-M-L's view.

I prefer to put my own time into explaining how to use the regular libraries and functions as in
Serial Input Basics
simple Python - Arduino demo
Simple nRF24L01+ Tutorial


...R
Two or three hours spent thinking and reading documentation solves most programming problems.

J-M-L

agreed a good tutorial on programing concepts and examples on how to combine libraries goes a long way to teach someone to fish
Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

GolamMostafa

It would be good to have all in one library that conatins many examples for beginners. And all what they would do is to call a method. Blinking, servo turning or anything else! Good news - I am creating one and version 1.0. is already availibe in the arduino library manager.
Rather, you would be better rewarded if you take an existing Library (say, OneWire.h) and explains the calling procedures of various methods of this Library. This is my opinion that goes in parallel with @Robin2 and @J-M-L.

Whandall

IMHO that library is utter nonsense and could serve as a multilevel example of bad programming.
Ah, this is obviously some strange usage of the word 'safe' that I wasn't previously aware of. (D.Adams)

J-M-L

#6
Mar 30, 2019, 05:58 pm Last Edit: Mar 30, 2019, 06:34 pm by J-M-L
and I had a quick look at the code, this is the servo fonction example:
Code: [Select]
void BasicsLibrary::servoTurning(int dataPin){
  #include <Servo.h>     
  Servo myservo;         
  int pos = 0;         

  myservo.attach(dataPin);   

  for(pos = 0; pos <= 180; pos += 1)
  {
    myservo.write(pos); 
    delay(15);           
  }
  for(pos = 180; pos >= 0; pos -= 1)
  {
    myservo.write(pos); 
    delay(15);           
  }

}
this is the worst program structuring ever.. bad use of a class as abstraction, #including directly within functions...

and it does nothing really fancy that is not included in the basic examples of a proper library...

gee I pray all gods that this won't start inspiring beginners...

This is your time, so you do what you want - but this does not sound really promising... (sorry, not trying to be harsh, just sharing my opinion. appreciate the sharing intent though)



Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

Robin2

and I had a quick look at the code, this is the servo fonction example:
That seems to give the user no scope to control things other than the pin used to control the servo. Frankly I think it is unhelpful.

And what happens if the user has one of the many servos that can't move through a full 180°.

This sort of thing should all be fully explained in the library documentation.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

UKHeliBob

Even if the code in the library were written in an exemplary manner it will be largely hidden from the user, particularly a new user, and I fear that it will be of little use in helping them understand how and why the Arduino environment operates.  Nor will it give them much, if any insight into C/C++

Personally, if I had tried to use it when I first came across the Arduino I would have tried something like the servo example and thought "is that it ?"  How would I make the servo move at a different speed and change the amount it moves ?  In contrast the servo Sweep example exposes the code and encourages you to change it to see what happens.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

GolamMostafa

#9
Mar 30, 2019, 07:46 pm Last Edit: Mar 30, 2019, 07:52 pm by GolamMostafa
Nowhere said in the Servo.h Library that the 50 Hz PWM at the signal pin of the servo is maintained by interrupt process. We have to struggle a lot to find it out through experiment that involved in the execution of servo.write() instruction only once in the setup() function and the PWM was there all the time.

The OP may spend his time to document such kinds of things and the similar for greater benefit and education of the Forum users.

Robin2

Nowhere said in the Servo.h Library that the 50 Hz PWM at the signal pin of the servo is maintained by interrupt process.
I'm not sure that a newbie need to know that interrupts are used. That is perhaps the opposite extreme to the OP's over-simplistic approach.

And the standard control system for servos (which the library implements) is widely documented elsewhere.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

neiklot

The only use I see for such a library, is perhaps (and even then it's a big perhaps) as the OP's own helper methods, where he may for example need to get an RTC time into some sketches and can have a whole bunch of methods "standing by" so to speak to be called upon.

But as a learning aid? As they say on Eurovison, "nil pwa" ;)

This is going to do the exact opposite of teaching: it's going to confuse the sh!t out of anyone new to this, right from the word go when you need to tell it what pin to use even when you don't use one.




neiklot

We have to struggle a lot to find it out through experiment that involved in the execution of servo.write() instruction only once in the setup() function and the PWM was there all the time.

We? Speak for yourself....


Coding Badly


@TomasRoj, please do not cross-post.  Other thread removed.


DBMcDonald

Currently, your BasicsLibrary produces compiler errors if you try and include it in a sketch.  You need to include examples with detailed explanations geared for beginners. Providing examples also ensures your code works.

Go Up