#include <SoftwareSerial.h>

#define SEN_PIN   A2   // Sensor
#define LED_PIN   PB1

#define SERIAL_TX PB3
#define SERIAL_RX PB0

#define LED_DELAY 1000

bool switchLED = false;
unsigned long timerLED = 0;

int sensorValue = -1;

SoftwareSerial mySerial(SERIAL_RX, SERIAL_TX);

void setup() {
  pinMode(SEN_PIN, INPUT);
  mySerial.begin(9600);
  analogWrite(SEN_PIN, 1);
}

void loop() {
  sensorValue = analogRead(SEN_PIN);

  if (millis() - timerLED >= LED_DELAY) {
    timerLED = millis();

    mySerial.print("Sensor Value: ");
    mySerial.print(sensorValue);
    mySerial.println();

    switchLED = !switchLED;
    digitalWrite(LED_PIN, switchLED ? HIGH : LOW);
  }
}
ATTINY8520PU