Hello,
I am trying to make two arduino's comunicate.
But here lies the problem how do I do that?
I have tried it with an if statement like:
if (Serial.read("go")){
}
I want to trigger one arduino's code by sending over serial a "triger"
The one problem I have left is that on the one arduino that need's to trigger the other I've only got two pins left, and those are the rx and tx pins:)
any help would be appreciated.
system
August 15, 2011, 1:31pm
2
if (Serial.read("go")){
And where did you find that form of the "read" method?
This subject comes up every other day - do some searching.
system
August 15, 2011, 1:33pm
3
The read method of the Hardware Serial class accepts no parameters. Take a look at this page Serial.read() - Arduino Reference .
Yes I know this doesn't work
it's just an example of what I want to achieve,
that the program start when it reads a trigger from serial.
But I just realized that this can be done way simpler/easier.
by just pulling a pin high on one arduino and let it be read by the other ,
If pin input high --> trigger sketch.
so sorry for posting a useless thread?
system
August 15, 2011, 2:02pm
5
You said you'd run out of pins.
Also be aware that serial communication is not instantaneous - make sure your application can cope with the inevitable latency.
yes this is true got no pins except for pin 1 and pin 0 ...
but I gues it's only one pulse so it can't hurt?
Be sure there is also a ground wire run between the two arduinos, and that both sketches have a Serial.begin() at the same baudrate.
This should help you get started:
//I have tried it with an if statement like:
if (Serial.avalible > 0) // has one or more characters arrived?
{
}
Lefty