Show Posts
Pages: 1 ... 44 45 [46] 47 48 ... 88
676  Community / Bar Sport / Re: Shop in a shipping container (somewhat off topic) on: September 17, 2012, 08:06:46 am
That was some heartwarming news. Something that actually keeps on giving, instead of requiring expensive parts/labour from the "generous" western countries.

The webpage says: "for $50,000, you can buy one directly from the designers" That seems like a steal, I think the price is only valid if resident in non-city regions of Africa. smiley-cool
677  Using Arduino / Programming Questions / Re: Why does it have to be static? on: September 17, 2012, 03:41:33 am
I really love the "Send us the code, before and after" "explain what you expect". 

I do the same. Hey, I even demand the same. (Years ago I was head of  support/QA in a company, the official bug report forms I designed had fields for this, with great success) I thought I was above such details this time. <beep> Wrong!

There is this great saying, that I use with friends/colleagues, when we hit an "impossible" problem/bug/behaviour in the systems we work with:

"Explain it to the teddy bear"

Usually, when explaining a problem in excruiating detail to the teddy bear (or a colleague  smiley-wink ) you suddenly see the problem from a new angle or discover a presumption you made that was never made explicitly clear.

And thus the error is discovereed, the problem solved. Humbly I realized my hidden assumption in this case, too.

So - the example in this thread will work.

My code (see the link) left the calling function (loop) and in again and the called function assumed(!) that the parameter it had gotten was unchanged by the caller. Which it wasn't as it is un-static.

I conclude it is very bad coding style for a function to assume that it can use the by reference parameters as (static) storage, between invokations of being called. Too aggressive in saving precious memory bytes. My excuse is that the function was always inline with global variable. As the linked thread says - I converted it to library, and this is where all probelms began. Before the variables were global but you cant do that with a library. I'll fix the code, and "waste" 3 bytes.

Thank you for reading. Now move along, there is nothing more to see here. smiley
678  Using Arduino / Programming Questions / Re: Why does it have to be static? on: September 17, 2012, 12:40:00 am
Damn. It just goes to show, when writing new and shorter code in the post, instead of doing a cut-n-paste from the real code, one introduces new errors. And there is one more error <sigh-  smiley-roll-blue > in my initial post. I was just gettng very very frustrated. Sorry. If you look at the real code (link in above post), you'll see that I do know the difference.

Still the problem is there.

When I write
Code:
static int P ;
  F ( &P ) ;
   :
void function F ( int *P) { *P = 42 ; }

it works fine

BUT when I use
Code:
/*dynamic*/ int P ;
 F ( &P ) ;
   :
void function F ( int *P) { *P = 42 ; }
I get "random" results
679  Using Arduino / Programming Questions / Re: Simple-yet-powerfull - Serial Command input with numbers on: September 16, 2012, 03:05:51 pm
(Embarassment  smiley-eek Found a bug in the float version. Now fixed. Original post edited.)
680  Using Arduino / Programming Questions / Re: Why does it have to be static? on: September 16, 2012, 02:46:02 pm
I just wrote this in hand to illustrae the essence. The actual code does use a different name. The actual code is http://arduino.cc/forum/index.php/topic,115174.0.html
681  Using Arduino / Programming Questions / Solved: Why does it have to be static? on: September 16, 2012, 02:05:56 pm
My main routine
Code:
static int P ;
function F ( &P ) ;
The function
Code:
void function F ( int *P) { P = 42 ; }
It fails mysteriously if the P is NOT declared static. It works for char data type, but not int or float.

(I was just browsing the GRBL software package where they have the same construction, and it works, presumably. Some time ago I did above and it failed, as I describe. A weak theory is that GRBL presumes a different toolchain to compile... but it still is the same compiler, right?)
682  Community / Bar Sport / Re: Interstellar Travel on: September 13, 2012, 11:36:26 am
Too late for me - I wont be buying a ticket.
 smiley-wink
683  Using Arduino / Motors, Mechanics, and Power / Re: More than 1 servo on: August 26, 2012, 02:17:38 pm
So... either you have a very bad/burned AVR-chip or your wiring is wrong or faulty - bad powersupply, a loose connection, unexpected short. (Possibly one servo is bad, messing up activity the other one)

Suggestion. Rebuild it. Take all wires off, rewire, cleaner, more carefully.
684  Community / Bar Sport / Re: Your latest purchase on: August 24, 2012, 10:59:58 am
You want mobile hackerspace, have a look at my truck smiley
Oooohh .... nice. A normal car driving license isn't enough, I presume.

Where is the Arduino?
685  Using Arduino / Motors, Mechanics, and Power / Re: (RPM) output 1600 pulses = 1 RPM on: August 19, 2012, 03:26:08 pm
The usual Stepper library is blocking, that is, it will not continue until it has given the number of steps.

The solution is a loop that closely resembles the "BlinkwithoutDelay" example. Instead of togging pin13 you call step(1) whenever the "millis()-timer" differnece exceeds the timing threshold. In the loop you also do a an analog read on every pass and calculate an updated value for the timing threshold.

Do not call Serial.print on every pass. This takes too much time. Only call it every 1000 millisec (which means you have another section with another timer that triggers once a second - have a look at  Blink Two LED without delay)

Enjoy
686  Using Arduino / Motors, Mechanics, and Power / Re: More than 1 servo on: August 19, 2012, 03:11:08 pm
OK, so you have tested with pin 9 and 10. What abouth the other 10 output pins?
687  Using Arduino / LEDs and Multiplexing / Re: 7 SEGMENT LED, LCD 2x16, and 25 LED's on: August 19, 2012, 03:06:24 pm
I'd use some simple shift register to drive the matrix LEDs and possibly a dedicated 7Seg decoder chip for the each of the 4 7seg. These can usually cascade so you only need 4 data, latch and clock (6 pins). The shift register can cascade another 3 pin. The LCD probably already is suitably mounted on some board so it does not need a shield as such, but they tend to use 10(?) pins. In other words, not a standard shield - the layout is too special. Remember you can use the A0-A5 pins as digital output, too.
688  Community / Bar Sport / Re: Curiosity - way too cool. Sunday. on: August 09, 2012, 05:19:47 pm
Don't know.

I don't either smiley BUT, I have seen something very similar on the sides of crashcars and crashtest-dummies. Seems it is a good point to measure movement on photo/videos as it is easy to find the centre and easy to see rotation.

Otherwise it might be a "warning" label that here "there be things that rotate". important that Martians do not get injuried if they examine the rover  smiley-lol .

They may have removed them before launch (we'll see in the transmitted pictures when the time comes) and/or, in conjunction with my photo-measurment-theory, they make it easy to see (possibly for the onboard computer vision) where tha axis of rotaion is when positioning the arm.

OK, I am out of smart-ass guesses.
689  Community / Bar Sport / Re: Curiosity - way too cool. Sunday. on: August 07, 2012, 12:55:37 am
Irrelevant fact: You can download the music (.mp3) for that "7 minutes of terror video". It is stuck in my brain in an infinite loop.

On that note, the "6 vehicle configurations" and the autonomous nature of the landing, I was idly pondering; what sort of Arduino based project could one build that has the same complexity charateristics, but scaled down 1000-fold? My first though would be something like a vehicle launched from my front door, that would drive down the street (Earth-Mars transit), cross an intersection (atmospheric entry) and a smaller part of it (all that jetissoning of transport shells) enter a store and go to particular spot (determined beforehand, with measurements). All that 100% automatic with the front door launch being timed so it fits the intersection light cycle. Actual price scanning would be partially remote controlled from my home.

No I am not building it. Fantasy-ware works first time and without hidden bugs smiley but I think an interesting mind-experiment.
690  Community / Bar Sport / Re: Curiosity - way too cool. Sunday. on: August 06, 2012, 04:04:39 pm
I piped the HD TV (Ustream) from NASA on my TV screen and enjoyed the show. If it wasnt for webcasting I would have seen nothing. (not interesting enough for the general public)

AFAIK no Arduino was involved in this mission ... ?  smiley
Pages: 1 ... 44 45 [46] 47 48 ... 88