Serial Communication without computer!!!

I'm trying to establish communication between the ATtiny2313 and Arduino uno through the serial port (RX) / (TX).
Question - Serial.begin () also works without a PC, or not? Because when i unplug arduino from computer and try to read a serial information the LED not want to blink :~
And if not than what can i do to establish communication?

My simple code for arduino:

int receivedata=0;
void setup()
{
  Serial.begin(1200);//1200 is max baud rate
  pinMode(13, OUTPUT);
}

void loop(){
 if(Serial.available()> 0 ) 
 {
   receivedata=Serial.read();
   digitalWrite(13, HIGH);
   delay(30);
 }
  digitalWrite(13,LOW);
  delay(10);
}

Serial.begin () also works without a PC, or not?

Yes, it does.

Because when i unplug arduino from computer and try to read a serial information the LED not want to blink

Which LED? My Arduinos have at least three each.

If you are referring to the RX and TX LEDs, those are controlled by the USB-to-serial converter chip, not the ATMega328 chip. If you are connecting directly from the RX and TX pins to the other chip, the TX and RX LEDs should not be expected to flash.

Hi.
I'm talking about 13 LED (installed) it`s like indicator.

I'm talking about 13 LED (installed) it`s like indicator.

Then, it would appear that the Arduino is not receiving anything.

You've said nothing about how the ATtiny2313 is connected to the Arduino, or what code is running on the 2313, so we can say nothing about what the potential problem is.

Attiny2313 send data and it is correct data :wink: for test i only send one value. To check if attiny2313 send some data i used osciloscope.
The code works when arduino is connected to PC but if not than nothing happens :frowning:
attiny2313 is directly connected via wire and attiny2313 tx is connected to arduino uno rx(0 pin)

Why, when i connect to pc the serial works, but when i unplug usb, there no binking? :frowning:

Why, when i connect to pc the serial works, but when i unplug usb, there no binking?

Because the Arduino has no power? How are you powering the Arduino? Connect another LED with resistor, and blink that one, to confirm that the Arduino is indeed working.

None and Nop it dont want blink. But when i connect with usb it works :smiley:
PS.
Power is 9V battery.

Is this maybe a some bug? Or else?

I found a bug yeeeee

It is strange but when i connect supply through Vin or jack, serial not working, but when i have usb supply without data pins it seems like it works :))

Power is 9V battery.

Which is next to useless.

You should not be putting 9V to Vin.

keda123:
Power is 9V battery.
Is this maybe a some bug? Or else?

No, this isn't a bug. Check two things:

  1. What is the voltage of Vin and the 5V pin on your Arduino, when powered from the 9V battery. I think you're going to be surprised.

  2. Are the grounds between the Arduino and Attiny connected?

PaulS:

Power is 9V battery.

Which is next to useless.

You should not be putting 9V to Vin.

Why i cant putt 9V battery to Vin? In manual said that: any voltage between 6 and 20 volts as Vin will work. 7 to 12 volts is highly recommended!!!

  1. I will check and see the magic or not :smiley:
  2. No Gnd are separate :wink: Because i need two devices.

keda123:
2. No Gnd are separate :wink: Because i need two devices.

Ground (GND) is a reference. If two devices do not share a common reference, then they will not be able to communicate with each other.

I saw the mystic. When Vin voltage is higer than 6.5V the lmv358 like shut down the atmega8u2 and serial wont work :frowning:
Maybe some know how to solve this.
PS.
In my project I use Motorshield with L293D chip which need higer voltage to drive motors :wink:

It may be a stupid question but if i have a two seperate supply they never communicate through serial? If it - how can i communicate?

The boards and the various power supplies all need to have their grounds connected, unless you are communicating between arduinos with some kind of wireless module (infrared, radio frequency)