Show Posts
Pages: 1 2 3 [4] 5 6 ... 226
46  Using Arduino / Programming Questions / Re: Relay Timer on: July 17, 2014, 11:46:32 am
Your IF statements should look like this

No it shouldn't.
I'm pretty sure the syntax for IF is

if (someVariable == HIGH)
{
  // do something here
}

Unless there is only one line of executable code.

Code:
if(INPUT_PIN1 == HIGH){

Quote
2) You don't compare pin numbers to HIGH/LOW, you compare pin states to HIGH/LOW. To convert a pin number to its state, you use digitalRead().
47  Using Arduino / Programming Questions / Re: Read entire string from Serial and split on: July 17, 2014, 11:18:59 am
http://forum.arduino.cc/index.php/topic,43568.0.html
48  Using Arduino / Programming Questions / Re: Relay Timer on: July 17, 2014, 11:16:42 am
Your IF statements should look like this

No it shouldn't.
49  Using Arduino / Programming Questions / Re: Relay Timer on: July 17, 2014, 10:40:16 am
will build a smådelstvätt for engine parts so then I have 6 kvappar that will control four relays that should be on 30 mins and 1hr on another. if you know what I mean. what should I look for?
\

I don't know what a smådelstvätt or a kvappar are, so I couldn't tell you.

If you want to control 4 relays, you have to be more explicit about how you want them to be controlled. Statement such as "I want relay 1 to be on for 10 minutes, of for 5. Afterwards, I want Relay 2 to be on for 6 minutes, then off for 10. At the same time that Relay 2 is turned on, I want relay 3 to also be turned on for 2 minutes, then off for 6" are explicit and describe exactly how you want the relays to function. They also help structure the code.
50  Using Arduino / Programming Questions / Re: Read entire string from Serial and split on: July 17, 2014, 10:20:57 am
And how would I go about storing the Serial data in an array? Sorry for my newbieness....

By looking at some of the serial examples and doing a search on the forums. This is probably the most answered question on these forums.
51  Using Arduino / Programming Questions / Re: Relay Timer on: July 17, 2014, 10:13:40 am
Code:
 if(knapp1,HIGH);

Whatever you think this is doing, it isn't.

1) Comma operator doesn't do a comparison, things like ==, <=, !=, >=, etc., do.
2) You don't compare pin numbers to HIGH/LOW, you compare pin states to HIGH/LOW. To convert a pin number to its state, you use digitalRead().
2) You shouldn't have a semicolon at the end of it
3) Any code that should run under that condition should be surrounded by parentheses.

Ditto for all of the other similarly looking lines.

For inputs you want to use

Code:
if(INPUT_PIN == high);

No you don't. "high" isn't a defined variable or constant, and you shouldn't be comparing a pin number to a state.
52  Using Arduino / Programming Questions / Re: Read entire string from Serial and split on: July 17, 2014, 10:11:08 am
Quote
since it's already comma delimited, maybe theres an easy way to split it up?

Store each non-comma and non-newline character in an array. When a comma or newline is received, process what's in the array and clear it out.
53  Using Arduino / Programming Questions / Re: How to extract data from arduino? on: July 17, 2014, 10:05:12 am
but the data that you can see  in serial monitor I need to record it in a file in a real time and this file is going to be read by other application at the same time.

So the quenstion is, how can i record these data in a file? I´ve never done it before in arduino.

Use a terminal program that supports logging to a file, such as PuTTY.

Quote
Sorry for my ignorance, what is a time stamp?

(08:04:20) Time stamps are simply a record of time
(08:04:28) for when an entry was inserted into a set
(08:04:32) of data.
54  Using Arduino / Programming Questions / Re: the input read only once, where the output will not change after the input chang on: July 17, 2014, 12:01:29 am
Code:
 if(digitalRead(Switch2) == HIGH)
  {
   Serial.print('1');
  }
  
  
  else if(digitalRead(Switch2)==HIGH && digitalRead (Switch3) == HIGH)
  {
    Serial.print('2');
  }  

Unless the input of switch 2 goes from LOW to HIGH within the fraction of a microsecond that this if/else if combo runs, you're not going to hit that else if. else if means that the previous if failed. If the if statement failed, then it's very likely that the else if will also fail, because it holds the same condition.
55  Using Arduino / Programming Questions / Re: Can you set up multiple delays in your program? on: July 16, 2014, 11:55:57 pm
So you're trying to multitask. Blink Without Delay example demonstrates how this can be done.
56  Using Arduino / Project Guidance / Re: What's the best way to power arduino for long term remote use on: July 16, 2014, 12:24:14 pm
but I am guessing there are more efficient boards that can handle a moisture sensor and a wireless card.  Any thoughts would be appreciated. Thanks

You guessed correctly. You can do something like the JeeNode (http://www.digitalsmarties.net/products/jeenode) which strips the microcontroller to the bare essentials and adds an RF transciever. The Moteduino (http://lowpowerlab.com/blog/2012/12/20/moteino-the-wireless-low-power-low-cost-arduino-clone/) is very similar. You could even do a custom one with a smaller microcontroller, like an ATTiny84. That's what I did for a light sensor and I managed to get it to run for a couple months on a coincell battery, sending a light reading every 8 seconds.
57  Using Arduino / Project Guidance / Re: Help understanding timers (delay or millis)? on: July 16, 2014, 11:14:34 am
millis() can handle all of this. StateChangeDetection example shows you how to look for a signal edge, as in, you want to know when the float switch goes from LOW to HIGH. You can then use millis to get the current time, and turn on the pump. Outside of those conditions, you can check to see if has been 20 seconds since you recorded the time, and turn the pump off if that's the case.
58  Using Arduino / Programming Questions / Re: How to extract data from arduino? on: July 16, 2014, 11:02:03 am
I´m developing a project, which, it is a sensor that sends the data through a wireless network with xbee boards. The problem is that, I want to receive the data from the sensor in a computer and use these data for other purposes. Another problem is that, it should do it in a real time, so in this case a data logger is not useful.

Why are those problems? If you're sending sensor data over an XBee, and you want to log it real-time on the computer, then you need to connect the XBee to the computer, and use some sort of program to write the incoming serial data to a file, presumably with a time stamp.
59  Using Arduino / Programming Questions / Re: pinMode or digitalWrite firrst.... on: July 16, 2014, 10:34:39 am
Why not try both options and see for yourself?
60  Using Arduino / Programming Questions / Re: limit on arays? on: July 14, 2014, 11:36:57 pm
Code:
  unsigned long timelog[1000];
  int datalog[1000];

6000 Bytes of RAM.

Uno has 2000 available. Yeah... not going to work.
Pages: 1 2 3 [4] 5 6 ... 226