Loading...
  Show Posts
Pages: [1]
1  Using Arduino / General Electronics / Re: 74hc595 shift reg - Turn off all outputs on arduino reset/startup/shutdown? on: April 07, 2013, 03:11:44 pm
When the Arduino goes into reset (Reset pin is activated or reset button pressed) the outputs should go into input/High-Z mode. So if the OE pin of the 74HC595 is pulled-up, it will also disable (High-Z) those outputs.

If you also want to catch a 'hung' Arduino you will have to use the watchdog timer to force a reset if the program is not running normally anymore.

Hope this helps,
Guido
2  Using Arduino / Microcontrollers / Re: Output high at bootup (need to stay low) on: December 01, 2012, 08:21:41 am
Do you use pull-down resistors on those 2 pins?

When the MCU resets, all i/o pins go into Tri-State (High Impedance) and then default to input pins (Also high input resistance) until your sketch defines them as output pins.

Using a resistor (one for each pin, 10K/47K or so) to ground will make sure the pin stays LOW unless explicitly driven HIGH by the output.

Hope this helps,
Guido
3  Using Arduino / Programming Questions / Re: How program a filter IIR with Arduino? on: November 09, 2012, 07:55:25 am
Maybe this will help : http://www.atmel.com/Images/doc2527.pdf
4  International / Deutsch / Re: IRLZ34N geht kaputt on: November 05, 2012, 06:59:38 am
Versuch mall ein wiederstand and der Gate (Zwissen gate und pin, 10-47 ohm oder so etwas).
Es koennte sein dass das MOSFET durch ringing die gate uberlasstet.
(Die wiederstand wird die turn-on/off-time etwas langer machen, sollte aber kein problem sein).

Hope this helps,
Guido
5  Using Arduino / Programming Questions / Re: Serial data always -1 when nothing happening on: November 01, 2012, 11:00:10 am
Do you get actual/meaningfull values when you print pulseDuration_0 & pulseDuration_1. The average beeing always -1 sounds like a overflow because of divide_by_0 or something like that.

Hope this helps,
Guido
6  Using Arduino / Programming Questions / Re: Serial.available acting funny on: October 22, 2012, 10:59:16 am
Couple of remarks, hope they can help.

First, the line '  //}' seems weird, with the comment marks it does NOT compile. Taking out the '//' compiles ok.

Next, does it actually print the "length" string? If x is not inside your range, nothing is done, whatever you receive.

Then, the line 'float distance = analogRead(1);', again hmm, analogRead returns a int, not a float. Not critical, but not clean.

But, most critical, you are not looping yourself, but using the Arduino background code to repeatedly call loop(). This means you are not in full control over what the system is doing. Even in the Arduino the microcontroller 'rule' the main function never exits is still a good one to follow.

Now, i am not sure, but it looks like the serial buffer is reset upon entering loop().

If i place the main block in a while(true) { .. } loop, it seems to work; at least it sees the incoming data etc.

Oh, and finally, the lines
        // say what you got:
        Serial.print("I received: ");
        Serial.println(incomingByte, DEC);
make no sense, inComingByte is initialise to 0 and never set.


HTH,
Guido
7  Using Arduino / Programming Questions / Re: sprintf ? on: October 06, 2012, 06:35:32 pm
As AWOL indicated, the stdlib (i think it is stdlib) linked in by Arduino does not support floats in the sprintf.
One way around this would be to tinker with Arduino IDE to include the full/extended stdlib to get the float working in sprintf.
Another way is to convert the float using :
    dtostrf(floatVar, minStringWidthIncDecimalPoint, numVarsAfterDecimal, charBuf);

Example :
Code:
  void setup() {
    Serial.begin(19200);
  }

  void loop() {
    float F = 1.25;
    char buffer[16];
 
    dtostrf(F,5,2,buffer);
    Serial.print("Float : ");
    Serial.println(buffer);
 
    //Do not loop
    while(true) {};
  }
8  Using Arduino / Programming Questions / Re: Strange problem with "sprintf" on: September 28, 2012, 10:39:28 am
Yes, the sprintf implementation used in Arduino seems to have a problem with floats. Not sure if it is code or the wrong module is being linked in or what.

However, the avr-libc function dtostrf() does work and you could use that. It will convert a float to a string, but it cannot include text like with sprintf. So you will have to print the segments separately or use an extra buffer and do the sprintf to insert the string in the text.

The function has to following parameters :
dtostrf(floatVar, minStringWidthIncDecimalPoint, numVarsAfterDecimal, charBuf);

Hope this helps,
Guido
9  Forum 2005-2010 (read only) / Syntax & Programs / Re: Push button problem again on: March 23, 2010, 05:45:23 pm
Hi.

Just my 2 cents worth.

You have a line :
 digitalWrite(buttonPin, HIGH);
Why would you write to this pin, you just defined it as a INPUT?

Also, there are 2 lines :
  buttonState = digitalRead(buttonPin);
  int buttonState = bouncer.read();
This will make things very confusing. I am sure the first line should be deleted, as you use the Bounce class.

Also, are you sure you are pressing/releasing/pressing the button inside 400 ms? As your code will only trigger if it sees HIGH - LOW - HIGH, within 400 ms?

For debugging, i would insert a line to print the time difference, probably after the line : if (buttonPushCounter % 2==0 ) {
, something like :
unsigned long delta = millis() - pressed_time;
Serial.println(delta,DEC);


Hope this helps,
Guido
10  Forum 2005-2010 (read only) / Troubleshooting / Re: time to switch between 0 and 1 and viceversa on: April 03, 2010, 02:26:43 pm
Hi.

Are you using manual or auto focus?

I am working in a similar trigger and use the camera on manual focus.
That way, i do not have to wait for the focus to be confirmed/attained.

I pulse the trigger output once to raise the mirror, and then pulse the output again to release the shutter when the event occurs.

Cheers.
Pages: [1]