       for (int n = 0; n < 16; n++) {
         //Lower PGC and write bit to PGD
         digitalWrite(PGC, LOW);
-        digitalWrite(PGD, bitRead(cmd, n));
+        digitalWrite(PGD, bitRead(payload, n));
         delayMicroseconds(1);
         
         //Raise PGC to send bit

        sendOp(B1001, 0x0000);
        break;
      case '3':
        break;
      case '4':
        break;
      case '5':
        break;

      for (int n = 0; n < 8; n++) {
        //Lower PGC and write bit to PGD
        digitalWrite(PGC, LOW);
        digitalWrite(PGD, bitRead(payload, n));
        delayMicroseconds(1);
        
        //Raise PGC to send bit
