Show Posts
Pages: [1] 2 3 ... 226
1  Using Arduino / Project Guidance / Re: I'm really new at this I need some help on: August 17, 2014, 02:24:24 pm
Is it dangerous or not?

Of course it's dangerous. Not knowing exactly what you are doing can get you killed at these voltage levels.
2  Using Arduino / Programming Questions / Re: Sending data from arduino to processing on: August 17, 2014, 10:25:30 am
There is a question.

Not a question, but I'm not going to quibble over semantics.

Quote
How can I receive channel value data from arduino?

Create a protocol. Typically this involves a start packet marker, end packet marker, and delimiters. On the receiving end, read the data, and parse the values out. You can change "ec" and "ev" to single letters and use a state machine.
3  Using Arduino / Programming Questions / Re: Birghtness value on LED from Serial on: August 17, 2014, 09:46:18 am
Quote
Pretty sure I read some where just to subtract 49? Or probably 48....

Or you can subtract '0', and not have to keep an ASCII table on standby whenever you work on the code.
This works great! Thanks. One question: There is a short delay on like 0.5-1 second before the value I send to the monitor is printed and the LED reacts. Can this delay be removed somehow?

Send a non-numeric value, letting parseInt() know that you're done sending the number.
4  Using Arduino / Programming Questions / Re: Birghtness value on LED from Serial on: August 17, 2014, 09:45:20 am
This works great! Thanks. One question: There is a short delay on like 0.5-1 second before the value I send to the monitor is printed and the LED reacts. Can this delay be removed somehow?

Send a non-numeric value, letting parseInt() know that you're done sending the number.
5  Using Arduino / Programming Questions / Re: Sending data from arduino to processing on: August 17, 2014, 09:42:54 am
I want to send dmx data (channel and channel value) from arduino to processing.

Ok, you have our permission.

Is there a question here? If you're having trouble, you're going to actually describe the problem you're having.
6  Community / Gigs and Collaborations / Re: PCB design support wanted on: August 15, 2014, 01:25:28 pm
Do you have the battery and sensors already picked out? If so it would probably help to post the links so that people can gauge the viability of running the system for what I'm calculating to be around 4500 hours on a single charge.
7  Using Arduino / Programming Questions / Re: sending a word on: August 15, 2014, 10:39:56 am
Arduino can only read one character at a time, so you need an array that can store the characters as they come in:

Code:
char myBuffer[10+1]; // Can receive 10 characters plus the null terminator

You also need a variable that keeps track of where in the array the next available slot is:

Code:
int myIndex = 0;

Every time you read a byte:

Code:
inByte = Serial.read();

You check if it matches a terminating character. This can be anything of your choosing, but a common tactic is to have the serial monitor send a newline, and use that:

Code:
if (inByte == '\n')

If this is true, then you can use strcmp() to see if it matches your string:

Code:
if (strcmp(myBuffer, "Red") == 0)

And take the action accordingly. You should also clear the buffer:

Code:
myBuffer[0] = '\0';
myIndex = 0;

If it does not match the new line character, you stick it into the buffer, increment the index and null terminate the array (required for use with string functions like strcmp()):

Code:
myBuffer[myIndex] = inByte; // put byte in buffer
myIndex++; // move to next index
myBuffer[myIndex] = '\0'; // and null terminate the array
8  Using Arduino / Programming Questions / Re: problem with string compare on: July 29, 2014, 06:48:28 pm
What are you mixing Strings and strings? Pick one, and stick with it.
9  Using Arduino / Programming Questions / Re: problem with string compare on: July 29, 2014, 06:44:20 pm
You can edit your post, you don't have to post a new reply if you need to fix something.
10  Using Arduino / Programming Questions / Re: Push Button Millis Timer Delay on: July 29, 2014, 06:43:38 pm
I feel like I just answered this question:

http://forum.arduino.cc/index.php?topic=257861.msg1822683#msg1822683
11  Using Arduino / Programming Questions / Re: How to set output pin to high for set time??? on: July 29, 2014, 03:22:47 pm
I can get the led on board to blink every 5 secs, but when I activate sensor the motor only works
while the sensor is activated. ie breaking the light beam.  I am trying to break the light beam with an object
and cut the dc motor on for 5 secs then everything reset.  This is what I have for code and I cant get it to work correctly.

See reply #1.
12  Using Arduino / Programming Questions / Re: How to set output pin to high for set time??? on: July 29, 2014, 11:27:09 am
I am trying to understand how the millis function works, but hitting a wall so far.

Then you're overthinking it. All the millis function does is return the number of milliseconds since the Arduino was last powered on or reset. It's a stopwatch that can't be paused or stopped, only reset. That's it.
13  Using Arduino / Programming Questions / Re: Fade sequence X times when button pressed on: July 29, 2014, 11:03:59 am
Step 1 is to define what you mean by "loop a certain number of times"  as your current code doesn't define a start or end point for what you consider to be a cycle. Based on your current code, It will likely have to do with time.

Step 2 is to figure out how to perform an action when a switch is pressed down. The StateChangeDetection example shows you how to accomplish this. Start by getting your switch to simply print something like "Hello" when this occurs.

Once you got that working, Step 3 it's time to figure out how to "record the time". Blink Without Delay example demonstrates using millis() for timing related concepts. Combined with step two, you can identify the time at which the button was pressed down. Combining that with step 1, you can figure out the time at which X number of cycles should stop.

At this point it's just a matter of if statements.

14  Using Arduino / Programming Questions / Re: How to set output pin to high for set time??? on: July 29, 2014, 10:55:20 am
Create a variable named lastTimeTheMotorWasOff and set its value to millis() whenever you turn the motor off.

Outside of any other conditions, check to see if millis() - lastTimeTheMotorWasOff is greater than 5 seconds. If it is, turn it off.

See the Blink Without Delay example for information on using millis()
15  Using Arduino / Programming Questions / Re: if (time passed and nothing received) on: July 29, 2014, 10:52:43 am
Every time you receive a message, set a variable named lastTimeAMessageWasReceived to millis().

Then you can check if millis - lastTimeAMessageWasReceived is greater than a certain value.
Pages: [1] 2 3 ... 226