suriya prakash
Published

Serial communication using attiny85 and arduino uno

Send a pulse to the arduino uno through by a attiny 85, using software serial communication

IntermediateProtip3 hours12,460
Serial communication using attiny85 and arduino uno

Things used in this project

Story

Read more

Schematics

circuit diagram

components:
ATTINY85
ARDUINO UNO
PUSHBUTTON
LED
WIRES

Code

TINY85(master ) code

C/C++
#include<SoftwareSerial.h>
SoftwareSerial swsri(3,4);
int pushButton = 1;
void setup() {
  swsri.begin(9600);
  pinMode(pushButton, INPUT);
}
void loop() {
  int buttonState = digitalRead(pushButton);
  swsri.println(buttonState);
  delay(1); 
}

Arduino uno(slave) code

C/C++
#include<SoftwareSerial.h>
SoftwareSerial swsri(4,5);
char c = ' ';
byte led = 13;
void setup()
{
  pinMode(led,OUTPUT);
  swsri.begin(9600);
}
void loop()
{
  char c = swsri.read();
  if(c == '0')
  {
    digitalWrite(led,LOW);
  }
if(c == '1')
  {
    digitalWrite(led,HIGH);
  }

}

Credits

suriya prakash

suriya prakash

2 projects • 2 followers

Comments