Hi, I'm working on a project that plays wav files from an SD card and prints a number for the song playing. I am using the Tmrpcm library and in the loop function of my sketch the lcd replaces my normal text with odd special characters. However the text in setup is normal. I believe to have narrowed it down to the program because the "hello world" example works just fine.
Here is my sketch:
#include <pcmRF.h>
#include <TMRpcm.h>
#include <SD.h>
#define SD_ChipSelectPin 10
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 5, 6, 11, 12);
byte face[8] = {
B01110,
B10001,
B11011,
B10001,
B10101,
B01110,
B00100,
};
TMRpcm tmrpcm;
int track = 1;
const int button1 = 4;
const int button2 = 2;
const int button3 = 3;
int state1 = 0;
int state2 = 0;
int state3 = 0;
void setup(){
lcd.createChar(0, face);
lcd.begin(16, 2);
lcd.write(byte(0));
lcd.print(" AudioMan Rdy!");
lcd.setCursor(0, 1);
lcd.print("Select Trk 1-6");
SD.begin(SD_ChipSelectPin);
tmrpcm.speakerPin = 9;
tmrpcm.play("BNV.wav");
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(button3, INPUT);
}
void loop(){
if (track > 6) { //Constrain numbers.
track = 0;}
if (track < 0) {
track = 0;}
state3 = digitalRead(button3); //Button control.
state2 = digitalRead(button2);
state1 = digitalRead(button1);
if (state3 == HIGH) {
track = track + 1;
delay(250);}
if (state2 == HIGH) {
track = 0;
delay(250);}
if (state1 == HIGH) {
track = track - 3;
delay(250);}
if (track == 2) { //Audio tracks.
tmrpcm.play("BN3t.wav");
track = 3;}
else if(track == 0){
tmrpcm.stopPlayback();}
else if(track == 4){
tmrpcm.play("BN4f.wav");
track = 5;}
}
Any help would be grealty appreciated. Thanks!