Monday, April 26, 2010

Task 46 - Sending a signal from one Arduino to another

I paired up with BJ to get one signal from one arduino to the other. BJ had the following code on his arduino:

BJ Smid*/

int reciever = 2;
int LED = 13;

void setup(){
pinMode(reciever,INPUT);
Serial.begin(9600);
}

void loop(){
//val = digitalRead(reciever);
if (digitalRead(reciever)==1){
Serial.println("H");
digitalWrite(LED,HIGH);
}
else{
digitalWrite(LED,LOW);
Serial.println("L");
}
delay(500);
}


I just had blink programmed on my arduino. This allowed my arduino to pass over a signal to BJ's arduino telling it whether or not my LED was blinking. If it was lit up, the arduino would send a signal telling BJ's arduino to light up an LED, otherwise it would send a signal to make sure it was off. BJ's arduino would also output to the screen whether it was high(lit up) or low(off).

No comments:

Post a Comment