Show Posts
Pages: 1 2 [3] 4 5 ... 225
31  Using Arduino / Project Guidance / Re: run a buzzer after 10 cycles of running program on: July 18, 2014, 10:06:06 am
Code:
   if((signal1 == HIGH && signal2 == HIGH) && (signal3 == HIGH && signal4 == HIGH))

signal1, 2, 3, etc. Are pin numbers. You shouldn't be comparing pin numbers to states. You should be using digitalRead to get the state of a digital pin, then compare the results to HIGH or LOW.
32  Using Arduino / Programming Questions / Re: PC Application for controlling Arduino on: July 18, 2014, 09:58:25 am
Processing
33  Using Arduino / Project Guidance / Re: explaining of delay() please on: July 18, 2014, 09:56:53 am
Okay....I'll do that. but can I also leave the delay part out of the script/program?

How could we possibly know that without seeing the code?

Quote
Or is it a required part of the script and must I set it to delay(1)?

If you remove it, the code will sill compile, but we have no idea if the sketch "requires" it.
34  Using Arduino / Programming Questions / Re: How to 'call' or run a sketch inside another sketch? on: July 18, 2014, 09:53:44 am
Copy the readCO2 function into it's own new tab off of the main sketch. Add an extern to the main sketch so that the compiler knows that the function definition will come from another file:

Code:
extern int readCO2();

Call the function from within your main sketch
35  Using Arduino / Project Guidance / Re: Using keyboard to control LEDs on: July 17, 2014, 05:04:48 pm
Is this possible at all?

Yes, but the majority of the work will be through a keylogger on your computer. Lighting an LED up when you receive a '1' or a '2' is trivial.

Quote
If so, is it possible to run while I'm doing something else (e.g. see how many times I press "R" in a League of Legends game) and not be forced to type in the serial monitor?


Again, yes, but that has little to do with the Arduino, and everything to do with the keylogger running on the computer.
36  Using Arduino / Programming Questions / Re: Converting Analog values to 12bits on: July 17, 2014, 11:58:03 am
Since the value I get is actually digital values, are there any other ways to convert this value to bits ?


Values are already store in "bits". You can use masking, shifting and other bit-wise operations to manipulate the bits as you see fit.
37  Using Arduino / Programming Questions / Re: atof function not returning correct value on: July 17, 2014, 11:47:22 am
What am I doeing wrong here?

Welcome to the wonderful world of floats.
38  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().
39  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
40  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.
41  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.
42  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.
43  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.
44  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.
45  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.
Pages: 1 2 [3] 4 5 ... 225