Hi,
I have my arduino due connected to an atmega through tx0/rx0. i need to transmit data to the atmega from arduino. my question is:
-
can i do it using the normal serial.write command?
-
do i need to select the particular serial port? if yes. how do i do that?
I have been using the following code:
Atmega:
char c;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()>0);
{
c=Serial.read();
}
if(c=='a')
{
digitalWrite(2, HIGH) ;
}
else
{
digitalWrite(2, LOW);
}
}
Arduino due:
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.write('a');
}
I am just a novice. Please spare any errors and help me out :?