Attiny_85_84_Serial_comm/Attiny_84_Slave.ino
2024-10-26 01:22:23 +02:00

25 lines
369 B
C++

// Code pour l'Attiny84
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3,NULL); //RX, TX
uint8_t blueLED = 10;
uint8_t v;
void setup() {
mySerial.begin(9600);
pinMode(blueLED, OUTPUT);
digitalWrite(blueLED, LOW);
}
void loop() {
v = mySerial.read();
if (v == '1')
digitalWrite(blueLED, HIGH);
if (v == '2')
digitalWrite(blueLED, LOW);
}