Pages: 1 [2] 3   Go Down
Author Topic: Is there a project to improve/replace the official examples?  (Read 4013 times)
0 Members and 1 Guest are viewing this topic.
Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4813
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I still have the problem with SD logging. SD cards need to reorganize from time to time and that can take up to 140 ms. For debugging I can log all data in every loop. But for real running I simply disable logging.

Some things will just take longer. I haven't delved deeply into SD, just use a library. It would be nice to interleave small tasks while waiting for the SD chip to finish housekeeping though and I am sure it can be done but may require extra buffer space.

Quote
... but anything that takes as long as an analog read gets a return to start loop() again.
Can you explain what you mean by this? Have you split the analog read in 2 actions?

No. But if I have say 4 analog sensors I read 1 at a time through loop() allowing other short tasks to run between analog reads. Like if I want Blink and 4 reads, the blink time gets checked 4 times for every 1 time that all the sensors are read, that is 4 times as responsive. I am giving the analog reads a lower priority.

Hey, I usually put Serial I/O last.
With Serial input I read and operate on each character as it comes in. I don't buffer and then parse and lex, I analyze on the fly to match commands and evaluate digits. It saves time by not wasting it and IME (in my experience) it's not more code than buffer and crunch, just different and faster.

For me it's about response and having my time-checks close. I do use micros() instead of millis() for fine work. A lot can be done in 1000 micros().

I agree lots can be done in 1000micros, but IMHO for most applications millis() is more than enough. I mean if a project has 5 (software) components each taking 2 millis() for a loop that is 10 millis() for the total project loop. That is still 100 times a second. In my experience that is more than enough for the average project and for most expert projects.

best regards
jantje
[/quote]

Do what you want. I write so that components are as unrelated as they can be and that includes order and priority of operation. I find state machines to be a more flexible approach trading nested levels of hard-coded logic for soft links via variables and pointers... and yes I have used tables of function pointers to organize code as well. It makes it easier to add/rearrange components and make major changes in how a whole package works. It is a far more spaghetti-resistant approach.

What I would really like is true parallel processing (and can achieve that with multiple AVR's if I take the time and have a task worth the effort). Until then I can can code to use the principles of parallel processing on a single chip.

So each time through loop() I run all necessary checks and actions and a slice of a task and that's it. Loop() keeps running, the tasks get done and it's dead simple to add tasks.
I coded for money for 19 years and school/hobby almost as long and one thing I most desire to avoid is a lot of deeply nested code. Consider Bauhaus vs Art-Deco.

Quote
Sergegsx:
I believe there is a timeout on the upload execution, the disadvantage of this is that you start loosing uploads if things take a little bit longer than expected.

How late is tolerable? Can it trigger an interrupt on data ready?

« Last Edit: May 30, 2013, 06:41:13 am by GoForSmoke » Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1926
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Back to the question of updating the examples, and possibly providing a way to catalog / find them:

Does anyone have a connection to the developers who can propose that a few very-involved forum supporters can get access to the example area?? 

I'm positive that good, well-documented examples would be the result.
Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26488
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try contacting Masssimo or any of the other founders, Terry - I'm sure they'd be amenable, given your track-record.

My personal gripe with some of the examples is overuse of globals where locals would be preferable.
« Last Edit: May 30, 2013, 06:30:35 am by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4813
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Back to the question of updating the examples, and possibly providing a way to catalog / find them:

Does anyone have a connection to the developers who can propose that a few very-involved forum supporters can get access to the example area?? 

I'm positive that good, well-documented examples would be the result.

A set of examples comes with every Arduino IDE.
Did I mention the use of String objects?

Also a thought, we could use a howto section on hardware that doesn't disappear.

BTW, can opto-isolators be used as voltage level shifters? I think so.....
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1926
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
A set of examples comes with every Arduino IDE.

There must be a repository of those that Arduino uses when they build a new release. That's what we need to get access to. It would be good to make those all consistent with the same basic template, and the same conventions so that they are a good example for users.

I would like to suggest a template like this: http://arduino-info.wikispaces.com/YourDuinoStarter_SketchTemplate

So BLINK would look like this:  http://arduino-info.wikispaces.com/YourDuinoStarter_Blink

And MAYBE there would be some more complex examples like: http://arduino-info.wikispaces.com/YourDuinoStarter_AutomationExample

Hmmm.

What do you guys think??  Would people be willing to work on updating many/most of them??    I think the simple ones are actually most important for new users.  The complex stuff will be mostly used by those with a clue??







Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

0
Offline Offline
Edison Member
*
Karma: 17
Posts: 1413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I like it
Logged

* Si preguntas, pon el código de tu programa, hace mucho mas fácil ayudarte. Y me ahorro un mensaje pidiendo que lo hagas.
* Si consigues solucionar tu problema, dedica unos minutos a explicar en tu post como lo conseguiste para beneficio de todos.
* Cambia el 'Subject' de tu hilo y añade 'SOLUCIONADO' cuando hayas llegado a una solución al problema que planteaste.
* Utiliza un 'Subject' para tu hilo que explique de que va el hilo.
Si estas empezando:
* Comienza a usar Arduino
* Guías de iniciación a Arduino
* Ejemplos
* Referencia del Lenguaje
* Conceptos básicos
Guia de usuario de arduino
Tutoriales en Ingles
Si necesitas que alguien te escriba el código: http://www.freelancer.com/  o esta  http://www.guru.com/

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1926
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I sent a PM to Massimo.

Longtime contributors like AWOL, CodingBadly, RobTillaert, Crossroads etal, etal, if you'd be up for reworking official examples, let us know...
Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1926
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The examples are in the github repository. For instance this is a link to the eeprom examples.
https://github.com/arduino/Arduino/tree/master/libraries/EEPROM/examples
I guess massimo will propose to do the changes in a fork on github and when you do a pull request they may become part of the release.
Best regards.
jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4813
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There should be some kind of review process with no one "owning" any sketch.

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1926
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I agree.. if Massimo will fork the examples, people could communicate (here?) and volunteer for particular examples.

No one should 'own' one, but the editors name and contact email should be in the source, IMHO. 
Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1926
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I agree.. if Massimo will fork the examples, people could communicate (here?) and volunteer for particular examples.

No one should 'own' one, but the editors name and contact email should be in the source, IMHO. 
In git anyone can fork any available code. So no need to bother Massimo with that.

The evaluation is done when someone who forked code does a pull request. At that point in time the owner of the code can look at the code accept/reject the proposed change. So in our situation the Arduino core team will do the "validation" after a pull request.

I think that if we propose anything to the core Arduino team we would be better to take this way of working as a guideline.

Best regards
Jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Offline Offline
Sr. Member
****
Karma: 4
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

dont hold your breath

we still as of 1.05  have all the warnings in the standard compile of the examples,
    like in the print, serial and tone libraries.

been in the official arduino release for years, fix's out there, but never put into the official release,,
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4813
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
dont hold your breath

Good advice. I started this thread to see about breathing some life into fixing the examples. Let's not hold that back!

If no one spends the time then that whole section stays unchanged.
But I see that here we do spend time, often on ships that sail off the world's edge for all that.

I also see a lot of time spent correcting some of the bad habits that many of the examples teach. So perhaps a proper effort will have good returns.

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Johannesburg, South Africa
Offline Offline
Full Member
***
Karma: 0
Posts: 180
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

/subscribing since I want to see where this goes. A lot of bad coding practices are in the examples, as already said and students learn from those bad examples. Better code will help everyone at the end of the day.
Logged

Offline Offline
Sr. Member
****
Karma: 4
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok,

stick my head above wall here. dont shoot it off.

SO , is there a definate list of examples,
    do we mean the ones that come up in the standard ( windows in my case ) install.

if so, how about making a list of them, is there a repository ?
   who wants to dish the examples out to be checked, and be responcible for updating ?

if we do all this, will the arduino team take the update on board into the release ?
   
Logged

Pages: 1 [2] 3   Go Up
Jump to: