   // seed random generator
   randomSeed(analogRead(7));
 
-  // start sending energy if we're a source
   isSource = digitalRead(button1pin) == LOW;
   if (isSource) {
+    // start sending energy
     addTimer(100, sendEnergy);
     switchLampOn(); // for debugging
   } else {
+    // start processing energy
+    processEnergy();
     switchLampOff();
-    processEnergy();
   }
 
   if(SERIAL_DEBUG) {


void loop() {
  if (isSource) {
    if (!digitalRead(button2pin)) {
      if(SERIAL_DEBUG) Serial.println("alert");
      char c = ALERT;
      for (int i=0; i<NUM_CONN; i++) txWrite(i, ALERT);

  // if(writeCounter < MAX_WRITES) return;
  if(SERIAL_DEBUG) {
    Serial.print("w");
    Serial.print(busIndex);
  }
  // begin with pulse so other side can start listening
  digitalWrite(TX[busIndex], LOW);
  delay(2);
  digitalWrite(TX[busIndex], HIGH);
  bus[busIndex]->write(value);
}

void setActiveBus(int busIndex) {
  if(SERIAL_DEBUG) {
    Serial.print("l");
    Serial.println(busIndex);
  }
  activeBus = busIndex;
  listenStartTime = millis();
  bus[activeBus]->listen();
}

void readActiveBus() {
