#!/bin/bash

echo "18" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio18/direction
echo "17" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio17/direction

while true;
do
  wert=`cat /sys/class/gpio/gpio17/value`
  if [ $wert -ne 0 ];
  then
    echo "0" > /sys/class/gpio/gpio18/value
  else
    echo "1" > /sys/class/gpio/gpio18/value
  fi
done
