i have a problem,
i tried to interface the arduino uno with the voice shield box (http://www.sparkfun.com/products/9799) from spark fun that using a SPEAKJET IC.
the problem is, by using the pull-up resistor…
when i press button 1… it will say the “ROGER-ROGER” pharse…
but,
when i press button 2… it will make a “PING sound” and it still repeating the “ROGER-ROGER” pharse…
what i’m trying to do is…
if button 1 press … say “roger2”…
if button 2 press… sound a “Ping Sound effect”… but not repeating the roger2 pharse
here is my coding:
// speakjet IC
#include <SoftwareSerial.h>
#define txPin 2
#define rxPin 3
SoftwareSerial speakJet = SoftwareSerial(rxPin, txPin);//text
char pingSound = {20, 96, 21, 114, 22, 88, 23, 5, 252};
char sayThis = {20, 96, 21, 120, 22, 120, 23, 12, 148, 135, 165, 151, 8, 148, 135, 165, 151};// push button
int inPin1 = 6;
int inPin2 = 7;
int val=0;
int val2=0;void setup()
{
// begin a serial Port
Serial.begin(9600);// Speakjet IC
pinMode(txPin, OUTPUT);
speakJet.begin(9600);
delay(1000);// push button
pinMode(inPin1, INPUT);
pinMode(inPin2, INPUT);
}void loop()
{
// Push button 1
//pin 6
val=digitalRead(inPin1);
if(val == LOW)
{
speakJet.print(sayThis); //roger2
delay (1000);
}//push button2
//pin 7
val2=digitalRead(inPin2);
if(val2 == LOW)
{
speakJet.print(pingSound); //ping
delay (1000);
}}
is there any problem with the coding??