I'm making an arduino program for a buzzer that you can record notes and song for and then play them back. I have 2 arrays that hold both pitch and if a note is being played. I continue to get errors that say expected unqualified-id before 'public'
.
Does anybody know how to fix this?
void setup()
{
Serial.begin(9600);
pinMode(5, INPUT_PULLUP);
pinMode(14, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
}
void freePlayMode()
{
int readP = analogRead(0);
int readB = digitalRead(5);
readP = map(readP, 0, 1023, 300, 2000);
Serial.println(readP);
if (readB == LOW)
{
tone(4, readP);
}
else
{
noTone(4);
}
}
void recordMode()
{
int readS2 = digitalRead(12);
if (readS2 == LOW)
{
rec();
}
else
{
if (readS2 == HIGH)
{
playBack();
}
}
}
void rec()
{
static public int recordings[99999999] = {NULL};
static public int notes[99999999] = {NULL};
int state;
static unsigned long i = 0;
int readP = analogRead(0);
int readB = digitalRead(5);
readP = map(readP, 0, 1023, 300, 2000);
Serial.println(readP);
if (readB == LOW)
{
tone(4, readP);
}
else
{
noTone(4);
}
if (i < 99999999)
{
if (readB == HIGH)
{
state == 0;
}
else
{
state == 1;
}
recordings[i] = state;
notes[i] = readP;
i++;
}
}
void playBack()
{
}
void loop()
{
int readS1 = digitalRead(14);
if (readS1 == LOW)
{
freePlayMode();
}
else
{
if (readS1 == HIGH)
{
recordMode();
}
}
}