#include <IRremote.h>
//min pwm code 22 - 130 pwm
//max pwm code 127 - 255 pwm
IRsend irsend(3);

const int BTN_FWD = A3;
const int BTN_REV = A2;

void setup() {
  pinMode(BTN_FWD, INPUT_PULLUP);
  pinMode(BTN_REV, INPUT_PULLUP);
  //Serial.begin(115200);
}

void loop() {
  // FWD button held
  if (digitalRead(BTN_FWD) == LOW) {
    while (digitalRead(BTN_FWD) == LOW) {
      irsend.sendSony(1, 50, 0, SIRCS_12_PROTOCOL);
      //Serial.println("Sending FWD: command 22");
      delay(46);   // short delay to keep packets coming
    }
  }
  // REV button held
  else if (digitalRead(BTN_REV) == LOW) {
    while (digitalRead(BTN_REV) == LOW) {
      irsend.sendSony(2, 50, 0, SIRCS_12_PROTOCOL);
     // Serial.println("Sending REV: command 22");
      delay(46);
    }
  }
}