Arduino code and video ISD1820 Arduino Voice Recorder

This is the Arduino code and video ISD1820 Arduino Voice Recorder

This video shows you how to measure the distance between 4cm to 180cm depending on the module, using Arduino. Sharp Analog output modules:
  1. ISD1820 Arduino Voice Recorder Manual (pdf)
  2. ISD1800 Series Datasheet (pdf)

 * ISD1820 Arduino Voice Recorder
 * to record and playback sound using Arduino and ISD1820 Sound Recorder

 * Watch the video
 * get this code from

 * ISD1820 Arduino Voice Recorder
 * Code Written by Ahmad Nejrabi for
 * on Jan 04, 2018 at 08:57, at Ajax, Ontario, Canada
  * Permission granted to share this code given that this
 * note is kept with the code.
 * Disclaimer: this code is "AS IS" and for educational purpose only.
#define REC 2 // pin 2 is used for recording
#define PLAY_E 3 // pin 3 is used for playback-edge trigger
// when PLAY_E goes HIGH device will playbak STARTS and continues
// ISD1820 Arduino Voice Recorder for 

#define PLAY_L 4 // pin 4 is used for playback  
// when PLAY_L is HIGH it will playback. As soon as it goes LOW playback STOPS
// So you have to keep it HIGH to keep playing

#define FT 5 // pin 5 is used for feed through
// if the SPI (speaker) pin is used to send Audio to other device, 
// set FT to high and any audio from microphone will pass through the SPI connector
// and will NOT record

#define playTime 5000 // playback time 5 seconds
#define recordTime 3000 // recording time 3 seconds
#define playLTime 900 // press and release playback time 0.9 seconds

void setup() 
  // ISD1820 Arduino Voice Recorder for 
  pinMode(REC,OUTPUT);// set the REC pin as output
  pinMode(PLAY_L,OUTPUT);// set the PLAY_L pin as output
  pinMode(PLAY_E,OUTPUT);// set the PLAY_e pin as output
  pinMode(FT,OUTPUT);// set the FT pin as output  
  Serial.begin(9600);// set up Serial monitor   

void loop() {
  // ISD1820 Arduino Voice Recorder for 
    while (Serial.available() > 0) {
          char inChar = (char);
            if(inChar =='p' || inChar =='P'){
            digitalWrite(PLAY_E, HIGH);
            digitalWrite(PLAY_E, LOW);  
              Serial.println("Playbak Started");  
              Serial.println("Playbak Ended");
            }// if          
            else if(inChar =='r' || inChar =='R'){
              digitalWrite(REC, HIGH);
              Serial.println("Recording started");
              digitalWrite(REC, LOW);
              Serial.println("Recording Stopped ");              
            else if(inChar =='l' || inChar =='L'){
            digitalWrite(PLAY_L, HIGH); 
              Serial.println("Playbak L Started");  
            digitalWrite(PLAY_L, LOW);
              Serial.println("Playbak L Ended");            
    // ISD1820 Arduino Voice Recorder for         
      Serial.println("**** Serial Monitor Exited");      
    }// wihile
Serial.println("**** Enter r to record, p to play");