Lab_interaccio/2011/Edgard/Edgard_Slave/Edgard_Slave.ino
2025-02-25 21:29:42 +01:00

60 lines
1.4 KiB
C++

#include <SoftwareSerial.h>
//#include <CAN.h>
//#include <pinout.h>
//#include <IRremote.h>
#define rxPin 2
#define txPin 10
//#define rxPin 5
//#define txPin 4
#define IR_IN 6
SoftwareSerial mySerial(rxPin, txPin);
void setup() {
Serial.begin(9600);
pinMode(rxPin, INPUT);
pinMode(IR_IN, INPUT);
pinMode(txPin, OUTPUT);
mySerial.begin(9600);
//irrecv.enableIRIn(); // Start the receiver
}
void loop() {
/* if (irrecv.decode(&results)) { //recepcion IR
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}*/
/*irsend.sendNEC(0xC1C7C03F, 32); // START/STOP
delay(2000);*/
if (Serial.available() > 0) { //Entrada XBEE
mySerial.write(Serial.read()); //Salida LANC
}
if (mySerial.available() > 0) { //Entrada LANC
Serial.write(mySerial.read()); //Salida XBEE
}
/*if(CAN.CheckNew()) Lectura Bus CAN
{
CAN.ReadFromDevice(&CAN_RxMsg);
//Debug
Serial.print(CAN_RxMsg.data[0],DEC);Serial.write(",");
Serial.print(CAN_RxMsg.data[1],DEC);Serial.write(",");
Serial.print(CAN_RxMsg.data[2],DEC); Serial.write(",");
Serial.print(CAN_RxMsg.data[3],DEC); Serial.write(",");
Serial.print(CAN_RxMsg.data[4],DEC); Serial.write(",");
Serial.print(CAN_RxMsg.data[5],DEC); Serial.write(",");
Serial.print(CAN_RxMsg.data[6],DEC); Serial.write(",");
Serial.println(CAN_RxMsg.data[7],DEC);
}*/
}