Here is my code:
#include <SPI.h>
//define output pins
#define DATAOUT 11 //MOSI
#define DATAIN 12 //MISO
#define SPICLOCK 13 //SCK
#define SLAVESELECT 10 //SSB
#define INPUTPIN 2 //Sensor input
//variables
byte index1 = 0;
byte index2 = 0;
byte j;
byte Playaddress = B10010110; // 0xA6
void setup()
{
Serial.begin (9600); // to see what is happening during run
SPI.begin(); //start SPI
SPI.setBitOrder(MSBFIRST); // MSB first
SPI.setClockDivider(SPI_CLOCK_DIV4); // SPI clock is system/4
SPI.setDataMode (SPI_MODE3); // SPI mode 3
INPUTPIN == HIGH;
pinMode (DATAOUT, OUTPUT);
pinMode (DATAIN, INPUT);
pinMode (SPICLOCK, OUTPUT);
pinMode (SLAVESELECT, OUTPUT);
digitalWrite (SLAVESELECT, HIGH); //disable device
digitalWrite (SPICLOCK, HIGH); //set clock to high for inactive mode
// SPCR = 01011000
//disables SPI interrupt, enables SPI, MSB first, Arduino is master
//inactive clock is high, rising edge active, 4 Mhz clock
//SPCR =(1<<SPE | 1<<MSTR |1<<CPOL)
//clr=SPSR
//clr=SPDR
}
byte makesound (index1, index2){ //make sound procedure
digitalWrite (SLAVESELECT, LOW); //selects ISD3900
SPI.transfer (Playaddress); //sends address for Play command
SPI.transfer (index1); //first byte of sound
SPI.transfer (index2); //2nd byte of sound
digitalWrite (SLAVESELECT, HIGH); //deselects ISD3900
}
void loop()
{
index1=0001100;
index2=0010011;
if (INPUTPIN == LOW)
makesound (index1, index2);
}
I get error messages:
'index1' was not declared in this scope
'index2' was not declared in this scope
initializer expression list treated as compound expression
There are others but I think that I can figure them out. Any help for this duffer?