Loading...
  Show Posts
Pages: [1] 2 3 ... 207
1  Development / Suggestions for the Arduino Project / Re: Is there a project to improve/replace the official examples? on: May 18, 2013, 01:43:45 pm
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.

... 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?
[/quote]

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?

2  Development / Suggestions for the Arduino Project / Re: Is there a project to improve/replace the official examples? on: May 18, 2013, 06:22:44 am
First find the part that is blocking execution.

My guess is it's client.connect(server, 80). Perhaps that library has alternatives to waiting.
3  Development / Suggestions for the Arduino Project / Re: Is there a project to improve/replace the official examples? on: May 17, 2013, 05:19:21 pm
I like to keep loop() short and not do everything every time as a matter of course. Some things get priority, especially ones that only happen on time or sensor input or interrupt flag with the ones that check quickest preferred happening sooner. I use state machines to control what part(s) run on any execution of loop(). It's not like loop() won't run again and the critical checks be made first sooner. I may run multiple sub-tasks in one pass through loop() but anything that takes as long as an analog read gets a return to start loop() again.

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().

4  Using Arduino / Programming Questions / Re: Issues with Pass Array of Structures to Library by Reference on: May 17, 2013, 02:52:59 pm
So your comfort zone is beginning to include pointers?

When using the sting.h functions, pointers abound as they're the best fit so often.

You probably have this web page bookmarked:
http://arduino.cc/en/Reference/HomePage

But do you have this? It gives you doc for the AVR libraries we use, like string.h:
http://www.nongnu.org/avr-libc/user-manual/modules.html

5  General Category / General Discussion / Re: Play-doh buttons and other things. on: May 17, 2013, 02:36:24 pm
Yes, that's possible with an Arduino or standalone AVR chip. It's probably something that would go physically viral in college dorms and might be a source of pocket money for an enterprising student with soldering skills.
6  Development / Suggestions for the Arduino Project / Re: Is there a project to improve/replace the official examples? on: May 17, 2013, 02:31:32 pm
Sorry about mixing up the terminology. I can't claim to be new to this either, LOL.

Potentially unsuitable... okay yes but in this case we only deal with bit zero.
The potential wrong is in how the bit(s) is/are used or checked. If other bits are used then the if() or while() or other way to check just one can include a mask of the others or use the bitRead() function to just get the one wanted.

I have no problem keeping many states as bits in unsigned variables and using bitwise logic to manipulate them en masse because I do keep track of which bits are used and how. Back in the late 80's I experimented with using Amiga graphics chip blit operations to work with whole arrays of bytes but nothing I did for work needed that.

7  Using Arduino / Project Guidance / Re: Long Range Narrow Beam Ultrasonic on: May 17, 2013, 08:36:24 am
My cheap unit has the transducers in open cylinders and has a 15 degree spread.

8  Using Arduino / Programming Questions / Re: Compile errors with Progmem on: May 16, 2013, 08:49:50 pm
I've only used PROGMEM and that only a few times.
9  General Category / General Discussion / Re: Looking for Enclosure for project on: May 16, 2013, 08:42:27 pm
What kind of materials would be okay for the box? How strong and tough must it be?

When you are in stores, look at all the containers you see. Will it fit inside a food can, biscuit or candy tin or plastic container?

You can take something light and coat or laminate a lot of strength to it. Fiberglass and epoxy resin sandwich over foam --- there are airplanes made that way.

You can mold many things like Sculpey or real clay or concrete mixed with fibrous strings of most any kind. Fire as needed.

Whatever you get or make can be coated and colored to suit if appearance matters. Metal can be etched or brushed. Soda and beer cans, use paint remover and steel wool to remove the label and find not bare aluminum but high shine plating used to make the label stand out.

Make sure to get more than one of a possible item just to have one or more to experiment for the best way to cut and form what you need cut or formed.


10  General Category / General Discussion / Play-doh buttons and other things. on: May 16, 2013, 08:19:06 pm
FWIW,

https://www.youtube.com/watch?v=kiUnJ1d8vvw

11  Using Arduino / Programming Questions / Re: Reversed Logic? on: May 16, 2013, 06:28:18 pm
The only mistake was in the understanding, not in the wiring unless you left the resistor out.
12  Using Arduino / Programming Questions / Re: Compile errors with Progmem on: May 16, 2013, 06:09:11 pm
Whoever wrote that note is either confused or didn't think long enough. I don't know if const gets the variable to not be copied to RAM but I add PROGMEM to make sure it stays in flash and last time I asked here the PROGMEM keyword had to be used.

Work it out. Everything in the sketch gets put into flash. WHY would it make sense to copy a constant into RAM when it's right there accessible in flash? For 1 extra cycle in speed?

You know how people who really don't understand something will hang up over rules that aren't actually rules? That note strikes me as that kind of 'puritanism'.

The 'new' stuff uses the F() macro to keep string literals in flash and print them from there. I don't know what else it can do but it does that without needing the PROGMEM keyword.
13  Using Arduino / Project Guidance / Re: comparing an array of inputs on: May 16, 2013, 05:47:32 pm
Yes with code we are making up stories but if the stories don't work it's no good and the stories are written in logic which is where being able to do higher math really helps. I did work at the U of D back in 1981 writing chemistry lessons for minimum wage and my job title was 'author'. If they don't pay much, you get a neat job title.

I would suggest that you work through the examples in the IDE that address parts of coding that you aren't sure about. Keep bookmarks to the Arduino Reference page and every other page or site with helpful info, especially references and tutorials. My browser lets me organize bookmarks and I have a wealth of such links. I need them at my age because words just slip away at times and I have to look again to get syntax and order right.

This ain't something you'll learn well in a week but you can get moving and accomplish simple tasks in two weeks if you keep at it. You might not do it the -best- way but as long as it works you're good!
14  Using Arduino / Programming Questions / Re: Compile errors with Progmem on: May 16, 2013, 04:08:47 pm
When you're ready, make a struct or better yet a class for your complex structure. It will hold some number of bytes and you know that you can store and fetch bytes to and from PROGMEM.

15  Using Arduino / Programming Questions / Re: error: unknown escape sequence '\c' problem on: May 16, 2013, 03:50:59 pm
Might as well get some entertainment out of this....

Will it go round in circles?
https://www.youtube.com/watch?v=FAVKG0I6XXA
Pages: [1] 2 3 ... 207