Show Posts
Pages: [1] 2 3 4
1  Development / Suggestions for the Arduino Project / Re: bug find? redclaration of int causes infinite loop... on: June 09, 2013, 10:17:16 pm
Quote

Local variables can have the same name as global variables.  Your code will use the most local version of the variable.


Does that mean it should have worked then?
2  Development / Suggestions for the Arduino Project / Re: bug find? redclaration of int causes infinite loop... on: June 09, 2013, 10:15:17 pm
I would have expected the ide to pop up with an error message instead of crashing the atmega. :-)
3  Development / Suggestions for the Arduino Project / bug find? redclaration of int causes infinite loop... on: June 08, 2013, 08:28:06 am
Code:


#include <avr/wdt.h>
char in[101];
int x = 0;

void setup() {
 
   wdt_disable() ;
  // put your setup code here, to run once:

Serial.begin(9600);
Serial3.begin(9600);
delay(10);
Serial.println(" Begin ");
Serial.flush();

}

void loop() {
 
  while (1 == 1){
 
  Serial.println(" Loop ");
  Serial.println(millis());
  Serial.flush();
  int x = 0;      // change this line to x = 0; and it works fine
  // put your main code here, to run repeatedly:
  while (Serial3.peek() != '$'){
   in[x] = Serial3.read();
   x = x + 1;
  }
 
 
   for (int i=0; i <= 100; i++){
      Serial.print(in[i]);
   }
   Serial.flush();
   
    for (int i=0; i <= 100; i++){
      in[i] = 0;
   }
 
 
 
  }
 
  delay(1000);
  Serial.print(millis());
 
 
}



The second line  int x = 0; was wrongfully redeclared inside the loop. This causes an infinite reboot loop ...

using latest ide (1.05)


4  Using Arduino / Sensors / Re: Clever low voltage monitor (no external components) on: January 28, 2013, 05:17:38 am
Just in case the link vanishes I have copied the code here

Code:

long readVcc() {
  long result;
  // Read 1.1V reference against AVcc
  ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  delay(2); // Wait for Vref to settle
  ADCSRA |= _BV(ADSC); // Convert
  while (bit_is_set(ADCSRA,ADSC));
  result = ADCL;
  result |= ADCH<<8;
  result = 1126400L / result; // Back-calculate AVcc in mV
  return result;
}

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println( readVcc(), DEC );
  delay(1000);
}
5  Using Arduino / Sensors / Clever low voltage monitor (no external components) on: January 28, 2013, 05:15:18 am
I found this clever little snippet of code that will return the supply voltage for the arduino using no external components! Would be great for those lipo projects !!!

http://code.google.com/p/tinkerit/wiki/SecretVoltmeter
6  Using Arduino / General Electronics / Re: Conrol the voltage of a buck converter .... on: November 21, 2012, 11:29:35 pm
Thanks for the input guys! So I guess the proper step here is to ask if anyone knows of some proper boards that are set up to be controlled instead of trying to find a hack that would make these cheap boards usable in that manner !

Are there any similar boards designed to be controlled for current/voltage from a micro controller signal?

7  Using Arduino / General Electronics / Conrol the voltage of a buck converter .... on: November 18, 2012, 08:15:29 am
Does anyone have any clever methods to modify one of these [url]http://www.ebay.ca/itm/1pcs-1-23V-30V-DC-DC-Buck-Converter-Step-Down-Module-LM2596-Power-Supply-Output-/110950894139?pt=LH_DefaultDomain_0&hash=item19d5304a3b&_uhb=1/url]to be able to control the output voltage from the arduino?

Or maybe there is a better way?
8  Using Arduino / Sensors / Re: External tank level sensing via density ? on: September 23, 2012, 11:45:16 pm
http://www.best-microcontroller-projects.com/capacitive-liquid-level-sensor.html

So indeed it is capacitance... A simple 555 circuit may work well here ! :-)
9  Using Arduino / Sensors / Re: External tank level sensing via density ? on: September 23, 2012, 11:29:53 pm
I found another system I suspect uses the same method... Looks to be more like a capacitance type system than a density based system as I had read in an article...

http://www.sailorssolutions.com/index.asp?page=ProductDetails&Item=TM03
10  Using Arduino / Sensors / Re: recommedation for ultrasonic water level sensor? on: September 23, 2012, 09:38:40 pm
The simplest depth sensor is using a tube sealed on one end, you connect an air pressure source ( hand pump etc... ) to the tube. Put air into the tube so that it just starts to bubble out the bottom of the tube, the air pressure required to displace this water will be the same pressure exerted by the height of water column displaced... Convert to height, calculate volume, the Freescale mpx10pd would measure approx 5ft of water depth.

Sorry it's not ultrasonic but this style of depth measurement is very common in industry!
11  Using Arduino / Sensors / Re: positioning sensors (GPS alternatives) on: September 23, 2012, 08:34:44 pm
What I'd you used this cheap sr04 sensors to find a location in the room ie the middle to make a pile ? That would be pretty simple?

I would imagine you will need to find a way to triangulate your position ... 2 fixed points of ir perhaps such as LEDs ... And a directional sensor ( tube on a receiver ) with angle measurements of some kind?

The better gps units such as gtpa010 are good to a few feet, might work for a leaf pile though?
12  Using Arduino / Networking, Protocols, and Devices / Re: uart serial current? What should be expected? on: September 23, 2012, 08:27:07 pm
So it turns out that my ftdi chip packed it in ... I suspect that it has been failing for a bit as I've had problems with that board! Too bad it took out a gtpa010 gps chip before it died!
13  Using Arduino / Sensors / External tank level sensing via density ? on: September 23, 2012, 08:24:33 pm
I stumbled across an interesting sensor that I cant seem to find any information on. The way I understand it is that this strip sensor is applied tithe outside of a tank and the resistance changes as the level changes inside the tank... It says the resistance increases as level increases from 50 - 500 ohms. Somehow it can tell the difference in density inside the tank, supposedly works on propane as well...

http://www.rvgauge.com/products/model_709.shtml

Does anyone know anything more about this ?
14  Using Arduino / Networking, Protocols, and Devices / Re: uart serial current? What should be expected? on: September 12, 2012, 05:06:43 am
1) To limit the current in case a wire became shorted etc ... ( breadboard )

2) After noting your comment I looked up your schematic and verified there are indeed 1K ohm resistors, however they are not pull down resistors, they go to the RX TX portion of the ft232rl chip. For this scenario to be plausible the ft232rl chip would have to ground the TX and RX portions of the chip which would put me close to explaining the current draw I found. This scenario however seems increasingly likely as putting the resistance below 1k would then put the data signal slightly about vcc/2 ...

3) As funny as you think your comment is, connecting a data line from a chip is no different ... other than the 3v3 is pulsed... and i need to verify that the current draw was what I suspected ... 5 ma is well within specs.
15  Using Arduino / Networking, Protocols, and Devices / uart serial current? What should be expected? on: September 12, 2012, 04:08:43 am
The other day I was playing with some serial communications from a GPS module and had resistors between the uart conections of the atmega328 and a gtpa010 GPS module and I noticed that the arduino would not receive serial inputs unless the resistor value was somewhat less than 1k ohm (i used 470ohm). I connected a 3v3 wire to the serial input Rx of the arduino and it read 5.5ma for a current! The FTDI chip on the arduino board worked fine with resistors at 2.2k ... (as high as i tested)

I suspect this number should be much lower than this! Is there some some setting for high impedance serial connections? Can someone explain why the current would be this high? How would i got about reducing the current?
Pages: [1] 2 3 4