Wow, I guess I forgot to change a few things in my code. It's amazing what you don't see after staring at something for so long. :o
I didn't know you had to connect grounds together, so I'll try that later on today (thanks mowcius!!) By the way, why do I need to connect the grounds?
So here is what could looks like after I made the suggested changes:
I didn't know you had to connect grounds together, so I'll try that later on today (thanks mowcius!!) By the way, why do I need to connect the grounds?
Becuase otherwise there is no potential difference.
If you are using a DC power supply for both of them then you don't normally (as the grounds are effectively tied together then) but if you are using batteries then you do as they are not connected in any way.
If they are both connected via USB then you don't need to either as they are both effectively connected to the same power source.
Okay, I tried running the modified code listed below and all it did was print a single ' ? ' on the Serial Monitor. So I'm quite puzzled. The program should send the ? to the Serial Port and when the other Arduino see is it should start running the writeBytesToSerial function, but apparently it does not work. Any suggestions? Other methods, changes to my code?
Okay, I tried running the modified code listed below and all it did was print a single ' ? ' on the Serial Monitor.
So, the Arduino is on one end and the Serial Monitor is on the other end. No place for the other Arduino in this setup, so it, of course, never receives the serial data.
Actually I have two Arduino's connected to each other. I open the Serial Monitor for the Arduino with the Read code to see what it is being sent. Both of the Arduino's are connected to my computer for power.
And sorry about not using the # button, I'm still new to posting.
So, the Arduino is on one end and the Serial Monitor is on the other end. No place for the other Arduino in this setup, so it, of course, never receives the serial data.
If the second arduino is connected to the first arduino via the tx/rx pins, then the serial monitor will receive what is being sent from the first arduino, assuming both are set to the same baud rate.
A response to ZoomKat's post, the one just above this....
I have a bad feeling about a setup where digital pins 0 and 1 are being used BOTH for comms with a "host/ development" PC (for the serial monitor) AND for comms with the other Arduino.
Yes, it probably CAN be done, if you get everything "just so"... but there would be fewer ways for "things" to go wrong if the Arduinos were connected via, say, digital pins 2 and 3... pin2 of Arduino "A" to pin 2 of Arduino "B" and 3 to 2.... and one or both Arduino's also communicated with one or two PC's running serial monitors, at least during the development stage of the process.
But then again, I do tend to worry too much. I can't say that I KNOW the "everything over D0 and D1" WON'T work.... I just wouldn't want to fight with the issues that could arise when I can so easily go around even the possibility of them.
I have a bad feeling about a setup where digital pins 0 and 1 are being used BOTH for comms with a "host/ development" PC (for the serial monitor) AND for comms with the other Arduino.
Perhaps a couple of aspirin and some rest.
Yes, it probably CAN be done, if you get everything "just so"...
Instead of a second arduino, I have my ssc-32 (really no different from a second arduino) connected to the arduino basically using three wires (allagator test leads, but #22 hookup works too). tx/rx, tx/rx, ground/ground. I'm no electrician, but I managed to hook up the three wires.
The way I use it is checking out a web servo control setup. With the arduino conneced to my laptop and the serial monitor open, I send a servo control request from my web page, which goes thru the router to the arduino ethernet shield. The arduino parces out the control data and sends it out the serial port to the ssc-32. What is sent to the ssc-32 is also displayed in the serial monitor, so I can see if there are issues with how the arduino is handling the request data. No rocket science involved.