#include <XNode.h>
int ledPinOne = 14;
int ledPinTwo = 15;
int output_pin = 0;
int output_virus_pin = 2;
int input_pin = 4;
int input_virus_pin = 5;
XNode node(input_pin, output_pin, input_virus_pin, output_virus_pin);
boolean action = false;
void setup () {
node.init();
pinMode(ledPinOne, OUTPUT);
pinMode(ledPinTwo, OUTPUT);
Serial.begin(115200);
}
void loop() {
Serial.println(node.listen());
if(node.listen() == true && action == false){
action = true;
Serial.println(action);
}
if(action == true){
for (int fadeValue = 0 ; fadeValue <= 1023; fadeValue += 20) {
analogWrite(ledPinOne, fadeValue);
analogWrite(ledPinTwo, fadeValue);
delay(30);
}
for (int fadeValue = 1023 ; fadeValue >= 0; fadeValue -= 20) {
analogWrite(ledPinOne, fadeValue);
analogWrite(ledPinTwo, fadeValue);
delay(30);
}
node.send();
action = false;
Serial.println(action);
}
}