/*----------------------------------------*/
// Test sending messages from master.
//
// In this script, master sends a message (command = 0x01)
// with alternating 0s and 1s for each node on the bus.
//
/*----------------------------------------*/

#include <stdint.h>
#include <util/delay.h>

#include "MultidropMaster.h"
#include "MultidropDataUart.h"

#define NODE_COUNT 1

int main() {
  uint8_t iteration = 1, i = 0;

  MultidropDataUart serial;
	MultidropMaster master(&serial);

  serial.begin(9600);
  master.setNodeLength(NODE_COUNT);
  
  while(1) {
    master.startMessage(0x01, MultidropMaster::BROADCAST_ADDRESS, 1, true);

    // Send alternating 1s and 0s
    for (i = 0; i < NODE_COUNT; i++) {
      if ((i + iteration) % 2 == 0) {
        master.sendData(0x01);
      } else {
        master.sendData(0x00);
      }
    }

    master.finishMessage();

    iteration++;
    _delay_ms(1000);
  }
}

/*----------------------------------------*/
// Test sending messages from master.
//
// In this script, master sends a message (command = 0x01)
// with alternating 0s and 1s for each node on the bus.
//
/*----------------------------------------*/

#include <stdint.h>
#include <util/delay.h>

#include "MultidropMaster.h"
#include "MultidropDataUart.h"

#define NODE_COUNT 1

int main() {
  MultidropDataUart serial;
  serial.begin(9600);
	MultidropMaster master(&serial);

  uint8_t iteration = 1, i = 0;
  master.setNodeLength(NODE_COUNT);
  while(1) {

    master.startMessage(0x01, MultidropMaster::BROADCAST_ADDRESS, 1, true);

    // Send alternating 1s and 0s
    for (i = 0; i < NODE_COUNT; i++) {
      if ((i + iteration) % 2 == 0) {
        master.sendData(0x01);
      } else {
        master.sendData(0x00);
      }
    }

    master.finishMessage();

    iteration++;
    _delay_ms(1000);
  }
}

--- 
+++ 
@@ -15,14 +15,15 @@
 #define NODE_COUNT 1
 
 int main() {
+  uint8_t iteration = 1, i = 0;
+
   MultidropDataUart serial;
-  serial.begin(9600);
 	MultidropMaster master(&serial);
 
-  uint8_t iteration = 1, i = 0;
+  serial.begin(9600);
   master.setNodeLength(NODE_COUNT);
+  
   while(1) {
-
     master.startMessage(0x01, MultidropMaster::BROADCAST_ADDRESS, 1, true);
 
     // Send alternating 1s and 0s
Rearrange code to be clearer
