   // 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) {

  //addTimer(50, processEnergy);
}

uint8_t rxRead(int index) {
  return *rxPortRegister[index] & rxBitMask[index];
}

void txWrite(int index, int value) {


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