Skip to content

Commit

Permalink
enabled ir rcv. commented out some debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
goldfish committed Sep 21, 2010
1 parent caec9fa commit 6543741
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
6 changes: 3 additions & 3 deletions README
Expand Up @@ -18,9 +18,9 @@
*
* Example: Blue robot wishes to capture a beacon
*
* _____ ___ ____
* | | | | | |
* ___| |_| |_| |
* _____ ___ ____
* | | | | | |
* ___| |_| |_| |
*
* A beacon indicates a neutral state by alternating red then
* blue status message
Expand Down
52 changes: 25 additions & 27 deletions VHSbeacon.pde
Expand Up @@ -88,26 +88,25 @@ void setup() {
}

void loop() {
/*
if (irrecv.decode(&results)) {
Serial.println( "Found ir data" );
if ((results.bits == 1) || (results.bits == 2)) {
switch (results.value) {
case CAPTURE_RED:
Serial.println( "Red Capture" );
beacon_state = CAPTURED_RED;
update_LED( LED_RED );
if (resetEnabled)
reset_at = millis() + resetTime;
break;
case CAPTURE_BLUE:
Serial.println( "Blue Capture" );
beacon_state = CAPTURED_BLUE;
update_LED( LED_BLUE );
if (resetEnabled)
reset_at = millis() + resetTime;
break;
}
if (irrecv.decode(&results)) {
Serial.println( "Found ir data" );
if ((results.bits == 1) || (results.bits == 2)) {
switch (results.value) {
case CAPTURE_RED:
Serial.println( "Red Capture" );
beacon_state = CAPTURED_RED;
update_LED( LED_RED );
if (resetEnabled)
reset_at = millis() + resetTime;
break;
case CAPTURE_BLUE:
Serial.println( "Blue Capture" );
beacon_state = CAPTURED_BLUE;
update_LED( LED_BLUE );
if (resetEnabled)
reset_at = millis() + resetTime;
break;
}
}
irrecv.resume(); // Receive the next value
}
Expand All @@ -117,27 +116,26 @@ void loop() {
update_LED( LED_GREEN );
reset_at = 0;
}
*/

// transmit beacon status
if (IS_NEUTRAL) {
//irsend.sendVHS(STATUS_RED, 2);
//irsend.sendVHS(STATUS_BLUE, 2);
sendBlue();
sendRed();
delay( 1000 );
Serial.println( "Neutral send" );
//Serial.println( "Neutral send" );
}
else if (IS_BLUE) {
//irsend.sendVHS(STATUS_RED, 2);
Serial.println( "Red send" );
//Serial.println( "Blue send" );
sendBlue();
}
else if (IS_RED) {
//irsend.sendVHS(STATUS_BLUE, 2);
Serial.println( "Blue send" );
//Serial.println( "Red send" );
sendRed();
}
delay(1);
}

void sendBlue ( ) {
Expand All @@ -154,7 +152,7 @@ void sendBlue ( ) {
digitalWrite( IR_OUT, HIGH );
delayMicroseconds( 1200 );
digitalWrite( IR_OUT, LOW );
delayMicroseconds( 600 );
delayMicroseconds( 1800 );
}

void sendRed ( ) {
Expand All @@ -171,7 +169,7 @@ void sendRed ( ) {
digitalWrite( IR_OUT, HIGH );
delayMicroseconds( 600 );
digitalWrite( IR_OUT, LOW );
delayMicroseconds( 600 );
delayMicroseconds( 1800 );
}

void update_LED ( int LED_COLOUR ) {
Expand Down

0 comments on commit 6543741

Please sign in to comment.