jegatheesan
Published © GPL3+

Interactive Television Show Game

Play a game on your PC with your touchtone phone.

AdvancedFull instructions provided1,167
Interactive Television Show Game

Things used in this project

Hardware components

DTMF Decoder
×1
Audio Cable
×1

Software apps and online services

Arduino IDE
Arduino IDE
Microsoft Visual Basic 6

Story

Read more

Code

TVGame.ino

Arduino
#include <LGSM.h>

#define PINNUMBER ""

char numtel[20];           // buffer for the incoming call

int checkpin=12;
int datapin1=8;
int datapin2=9;
int datapin3=10;
int datapin4=11;
int buttonpress=0;
int numberpress=0;

int callstatus;

void setup()
{  
  pinMode(checkpin, INPUT);
  pinMode(datapin1, INPUT);
  pinMode(datapin2, INPUT);
  pinMode(datapin3, INPUT);
  pinMode(datapin4, INPUT);  

  callstatus=0;
  
  Serial.begin(9600);
  boolean notConnected = true;
  LVoiceCall.hangCall();
}

void loop()
{  
  switch (LVoiceCall.getVoiceCallStatus()) 
  {
    case TALKING:  // In this case the call would be established
      callstatus=3;
      dtmfdetect();
      break;    
    case IDLE_CALL: 
      if (callstatus!=1)
      {
        callstatus=1;
        Serial.println("O");          
      }
      break;
    case RECEIVINGCALL: 
      callstatus=2;
      Serial.println("S");
      LVoiceCall.retrieveCallingNumber(numtel, 20);
      LVoiceCall.answerCall();         
      break;
  }
}

void dtmfdetect()
{
  if (digitalRead(checkpin) == HIGH && buttonpress==0) {
    buttonpress=1;
  }else if (digitalRead(checkpin) == LOW && buttonpress==1) {
    buttonpress=0;    
    numberpress=0;
    if(digitalRead(datapin1) == HIGH)
    {
      nuSOS5Omberpress=numberpress+1;
    }
    if(digitalRead(datapin2) == HIGH)
    {
      numberpress=numberpress+2;
    }    
    if(digitalRead(datapin3) == HIGH)
    {
      numberpress=numberpress+4;
    }        
    if(digitalRead(datapin4) == HIGH)
    {
      numberpress=numberpress+8;
    }            
    Serial.println(numberpress);          
  }
}

Credits

jegatheesan

jegatheesan

18 projects • 67 followers
Simply A Mechatronics Lover.

Comments