[

```
//Imports the BitVoicer library to the sketch
#include <BitVoicer11.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//Instantiates the BitVoicerSerial class
BitVoicerSerial bvSerial = BitVoicerSerial();
//Stores the data type retrieved by getData()
int dataType = 0;
//Stores the state of pins
int relay1 = 31;
int relay2 = 22;
int relay3 = 33;
int relay4 = 24;
int relay5 = 35;
int relay6 = 26;
int relay7 = 37;
int relay8 = 28;
int relay9 = 39;
int relay10 = 30;
int relay11 = 41;
int relay12 = 32;
int relay13 = 43;
int relay14 = 34;
int relay15 = 15;
int relay16 = 36;
void setup()
{
lcd.begin(16, 2);
//Starts serial communication at 9600 bps
Serial.begin(9600);
//Sets digital pins as OUTPUT
pinMode(22, OUTPUT);
pinMode(24, OUTPUT);
pinMode(26, OUTPUT);
pinMode(28, OUTPUT);
pinMode(30, OUTPUT);
pinMode(32, OUTPUT);
pinMode(34, OUTPUT);
pinMode(36, OUTPUT);
pinMode(31, OUTPUT);
pinMode(33, OUTPUT);
pinMode(35, OUTPUT);
pinMode(37, OUTPUT);
pinMode(39, OUTPUT);
pinMode(41, OUTPUT);
pinMode(43, OUTPUT);
pinMode(45, OUTPUT);
}
void loop()
{
//Updates the state of pins on every loop
digitalWrite(31, relay1);
digitalWrite(22, relay2);
digitalWrite(33, relay3);
digitalWrite(24, relay4);
digitalWrite(35, relay5);
digitalWrite(26, relay6);
digitalWrite(37, relay7);
digitalWrite(28, relay8);
digitalWrite(39, relay9);
digitalWrite(30, relay10);
digitalWrite(41, relay11);
digitalWrite(32, relay12);
digitalWrite(43, relay13);
digitalWrite(34, relay14);
digitalWrite(45, relay15);
digitalWrite(36, relay16);
}
//This function runs every time serial data is available
//in the serial buffer after a loop
void serialEvent()
{
//Reads the serial buffer and stores the received data type
dataType = bvSerial.getData();
//Checks if the data type is the same as the one in the
//Voice Schema
if (dataType == BV_INT)
// commands from bitvoicer are numbered.
if (bvSerial.intData == 0)
relay1 = LOW;
if (bvSerial.intData == 1)
relay1 = HIGH;
if (bvSerial.intData == 2)
relay2 = LOW;
if (bvSerial.intData == 3)
relay2 = HIGH;
if (bvSerial.intData == 4)
relay3 = LOW;
if (bvSerial.intData == 5)
relay3= HIGH;
if (bvSerial.intData == 6)
relay4 = LOW;
if (bvSerial.intData == 7)
relay4 = HIGH;
if (bvSerial.intData == 8)
relay5 = LOW;
if (bvSerial.intData == 9)
relay5 = HIGH;
if (bvSerial.intData == 10)
relay6 = LOW;
if (bvSerial.intData == 11)
relay6 = HIGH;
if (bvSerial.intData == 12)
relay7 = LOW;
if (bvSerial.intData == 13)
relay7 = HIGH;
if (bvSerial.intData == 14)
relay8 = LOW;
if (bvSerial.intData == 15)
relay8 = HIGH;
if (bvSerial.intData == 16)
relay9 = LOW;
if (bvSerial.intData == 17)
relay9 = HIGH;
if (bvSerial.intData == 18)
relay10 = LOW;
if (bvSerial.intData == 19)
relay10 = HIGH;
if (bvSerial.intData == 20)
relay11 = LOW;
if (bvSerial.intData == 21)
relay11 = HIGH;
if (bvSerial.intData == 22)
relay12 = LOW;
if (bvSerial.intData == 23)
relay12 = HIGH;
if (bvSerial.intData == 24)
relay13 = LOW;
if (bvSerial.intData == 25)
relay13 = HIGH;
if (bvSerial.intData == 26)
relay14 = LOW;
if (bvSerial.intData == 27)
relay14 = HIGH;
if (bvSerial.intData == 28)
relay15 = LOW;
if (bvSerial.intData == 29)
relay15 = HIGH;
if (bvSerial.intData == 30)
relay16 = LOW;
if (bvSerial.intData == 31)
relay16 = HIGH;
if (bvSerial.intData == 31)
lcd.clear ();
if (bvSerial.intData == 31)
lcd.print("RELAY 16 ON");
if (bvSerial.intData == 35)
lcd.clear ();
if (bvSerial.intData == 35)
lcd.print("CHECK OFF");
if (bvSerial.intData == 34)
lcd.clear ();
if (bvSerial.intData == 34)
lcd.print("CHECK ON");
// all lights on or off
if (bvSerial.intData == 32)
relay1 = HIGH;
if (bvSerial.intData == 33)
relay1 = LOW;
if (bvSerial.intData == 32)
relay2 = HIGH;
if (bvSerial.intData == 33)
relay2 = LOW;
if (bvSerial.intData == 32)
relay3 = HIGH;
if (bvSerial.intData == 33)
relay3 = LOW;
if (bvSerial.intData == 32)
relay4 = HIGH;
if (bvSerial.intData == 33)
relay4 = LOW;
if (bvSerial.intData == 32)
relay5 = HIGH;
if (bvSerial.intData == 33)
relay5 = LOW;
if (bvSerial.intData == 32)
relay6 = HIGH;
if (bvSerial.intData == 33)
relay6 = LOW;
if (bvSerial.intData == 32)
relay7 = HIGH;
if (bvSerial.intData == 33)
relay7 = LOW;
if (bvSerial.intData == 32)
relay8 = HIGH;
if (bvSerial.intData == 33)
relay8 = LOW;
if (bvSerial.intData == 32)
relay9 = HIGH;
if (bvSerial.intData == 33)
relay9 = LOW;
if (bvSerial.intData == 32)
relay10 = HIGH;
if (bvSerial.intData == 33)
relay10 = LOW;
if (bvSerial.intData == 32)
relay11 = HIGH;
if (bvSerial.intData == 33)
relay11 = LOW;
if (bvSerial.intData == 32)
relay12 = HIGH;
if (bvSerial.intData == 33)
relay12 = LOW;
if (bvSerial.intData == 32)
relay13 = HIGH;
if (bvSerial.intData == 33)
relay13 = LOW;
if (bvSerial.intData == 32)
relay14 = HIGH;
if (bvSerial.intData == 33)
relay14 = LOW;
if (bvSerial.intData == 32)
relay15 = HIGH;
if (bvSerial.intData == 33)
relay15 = LOW;
if (bvSerial.intData == 32)
relay16 = HIGH;
if (bvSerial.intData == 33)
relay16 = LOW;
}
```