Dear Team
I am using libpololu-arduino library to build my robot
I am using 3pi PID Simple line follower arduino code
So I need to connect another Arduino Uno board to my robot which has been 3pi code uploaded
As per my program I sent the Letter ‘A’ from 3pi code uploaded Arduino board to another Arduino board and once the Letter 'A: received by the another Arduino board then LED connected to pin 13 should blink
I used Serial.begin(9600); both program and tested but it does not working
I already connected Rx pin to Tx pin and Tx pin to Rx
Few Codes from 3pi code uploaded board
void loop()
{
Serial.begin(9600);
Serial.println('A');
// Get the position of the line. Note that we *must* provide
// the "sensors" argument to read_line() here, even though we
// are not interested in the individual sensor readings.
unsigned int position = robot.readLine(sensors, IR_EMITTERS_ON,1);
It sounds like you have two Arduino Uno boards connected together via serial. Is that correct? Can you post pictures clearly showing how everything is connected in your setup?
Can you make sure you have a common ground connection between the two Arduino boards and try replacing your Serial.println commands with Serial.write? Also, in your code for the first Arduino board, you should move Serial.begin(9600) to the top of the setup() function so that you are not repeatedly reinitializing serial communication between the two Arduino boards.
It’s difficult to see some of your connections between the two Arduino boards, but it looks like you might be connecting the 5V line from one Arduino to the other. If so, you should not do that if both boards are powered through USB since it could damage the on-board regulators. You should remove that wire and measure their voltages using a multimeter to verify that they’re still outputting 5V.
Can you post screenshots of the serial terminals showing the problem?
It seems like there is a problem with your other code; you’re probably not sending values in the correct format (or handling them properly). I suggest simplifying your code on both your boards, where one is just transmitting a character (e.g. ‘A’) and the other is receiving, verifying that your boards are able to communicate with each other. Once you get that working, you can gradually modify the transmitting code to look like your original code.
I simplified the code as showing below and tested but no success
// The following libraries will be needed by this demo
#include <DcubeRobot.h>
#include <PololuQTRSensors.h>
#include <DcubeMotors.h>
#include <DcubeAnalog.h>
#include <DcubeLEDs.h>
#include <DcubeLCD.h>
#include <DcubePushbuttons.h>
#include <DcubeBuzzer.h>
// Board Selected as "Pololu Orangotan or 3pi robot w/ATMega329P"
void setup()
{
//Serial.begin(9600);
// Serial.begin(19200);
Serial.begin(115200);
}
void loop()
{
Serial.println("A");
//Serial.write("A");
//Serial.println('A');
//Serial.write('A');
}
When I connected both board with Arduino bootloader then everything work perfect but only issue one board selected as pololu oranotan or 3pi 326p and program it using ICSP
Is there any special library to include to libpololu-arduino library for Serial Communication
You should not be trying to program your Arduino boards as an Orangutan or a 3pi. The Orangutan and 3pi were not designed as official Arduino boards, and run at 20 MHz instead of 16 MHz, so when you select “Pololu Orangutan or 3pi robot w/ ATmega328P” in your Arduino IDE, the Serial library assumes it is running on a 20 MHz board when you are actually running on a 16 MHz board, causing it to use the wrong baud rates.
As I said in my previous post, for your setup, you should not be trying to program your Arduino boards as an Orangutan or a 3pi. I recommend selecting “Arduino/Genuino Uno” in the “Board” menu of the Arduino IDE.
Can you enable verbose output in the Arduino IDE and post a copy of the entire output here? You can turn on verbose output by selecting File->Preferences in the IDE, and then checking the “compilation” and “upload” boxes next to "Show verbose output during: ".