Wave Sheild Odd Issue

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Re: Wave Sheild Odd Issue

Postby adafruit_support_rick » Fri Jul 27, 2012 11:02 am

A simple test - If you have the adafruit LiquidCrystal library in your libraries folder, remove or rename it. That will force the IDE to use the standard Arduino LiquidCrystal library. You shouldn't have to change any of your code. Try it and see if it helps...
User avatar
adafruit_support_rick
 
Posts: 2881
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Wave Sheild Odd Issue

Postby Lastborn » Fri Jul 27, 2012 2:58 pm

I downloaded the Arduino 1.0 IDE and it came with the default LCD library. Unfortunately I am not usinng SPI LCD and the post didn't help. Is the arduino LCD different from Adafruit's ?
Lastborn
 
Posts: 28
Joined: Mon Jul 23, 2012 9:01 am

Re: Wave Sheild Odd Issue

Postby adafruit_support_rick » Fri Jul 27, 2012 3:24 pm

Adafruit modified the LiquidCrystal library for use with the SPI/I2C LCD Backpack. The customer in the other thread discovered a conflict between the SPI operations in the modified library and the standard Arduino SPI library.

My thought was that, if you *were* using the adafruit version, then perhaps there was some other, non-SPI-related conflict we weren't aware of.
User avatar
adafruit_support_rick
 
Posts: 2881
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Wave Sheild Odd Issue

Postby Lastborn » Fri Jul 27, 2012 7:19 pm

So I am not using the adafruit Library. If anyone knows another way around this, I'd appreciate it. Thanks.
Lastborn
 
Posts: 28
Joined: Mon Jul 23, 2012 9:01 am

Re: Wave Sheild Odd Issue

Postby Lastborn » Mon Jul 30, 2012 9:29 am

Hi, I have modified the Wavepindefs.h and I grounded the LDAC pin. I still can't get it to work :( Help somebody!

Code: Select all
#include <avr/io.h>
#include <avr/interrupt.h>
#include <LiquidCrystal.h>

#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"


SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the filesystem on the card
FatReader f;      // This holds the information for the file we're play

WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time
int ledPin = 41;
int button = 21; //interrupt 2



volatile int state = 0;

LiquidCrystal lcd(12,11,5,4,3,2); //LCD connected pins

int sensorPin = A7; //analog temp sensor input
volatile int sens =0;  //increment variable for temp sensor
volatile float reading, voltage, temp;

volatile int sec=0;
volatile int sec1=0;
volatile int mn=0;
volatile int mn1=0;
volatile int hr;
volatile int hr1=0;

void setup() {
  lcd.begin (20,4);
  //sei();
  pinMode(24, OUTPUT);
  pinMode(25, OUTPUT);
  pinMode(26, OUTPUT);
  pinMode(27, OUTPUT);

// sei();
 
  Serial.begin(9600);     

  pinMode(button, INPUT);  //BUTTON
  digitalWrite(19, HIGH);    // Enable pullup resistor


 
//     if (!card.init()) {         //play with 8 MHz spi (default faster!) 
//    //putstring_nl("Card init. failed!");  // Something went wrong, lets print out why
//    //sdErrorCheck();
//   return;// while(1);                            // then 'halt' - do nothing!
//  }
//  //card.partialBlockRead(true);
//  {
//    uint8_t part;
//  for (part = 0; part < 5; part++) {     // we have up to 5 slots to look in
//    if (vol.init(card, part))
//      break;                             // we found one, lets bail
//  }
//  }
//  // Try to open the root directory
//  if (!root.openRoot(vol)) {
//    //putstring_nl("Can't open root dir!"); // Something went wrong,
//   return; //while(1);                             // then 'halt' - do nothing!
//  }

    cli();
    TCCR3A = 0;     // set entire TCCR3A register to 0
    TCCR3B = 0;     // same for TCCR3B

    // set compare match register to desired timer count:
    OCR3A = 15624;
    // turn on CTC mode:
    TCCR3B |= (1 << WGM32);
    // Set CS10 and CS12 bits for 1024 prescaler:
    TCCR3B |= (1 << CS30);
    TCCR3B |= (1 << CS32);
    // enable timer compare interrupt:
    TIMSK3 |= (1 << OCIE3A);
    // enable global interrupts:
    sei();
   
  attachInterrupt (2, talkISR, RISING); //external interrupt for talk function
  //lcd.begin (20,4);   
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print ("                    ");
  lcd.setCursor (0,0); lcd.print ("The University Of");
  lcd.setCursor (5,1); lcd.print ("SHEFFIELD");
  lcd.setCursor (0,3); lcd.print ("OLUWATOBI BABATUNDE");  //Designed by Oluwatobi Babatunde c2012
  delay(4000);
  lcd.clear();  //clears display
  lcd.setCursor(0,0);
  lcd.print ("                    ");
  lcd.setCursor (3,0);
  lcd.print ("24-HOUR CLOCK");
  delay(1000);
  lcd.setCursor (3,0);
  lcd.print ("SPEAKING CLOCK");

if (card.init())
{
  uint8_t part;
  for (part = 0; part<5; part++)
  {
    if (vol.init(card, part))
    break;
  }
}
else return;
  if (root.openRoot(vol))
  {
    playcomplete ("01.WAV");
  }
  else return;

}
//void sdErrorCheck(void)
//{
//  if (!card.errorCode()) return;
//  putstring("\n\rSD I/O error: ");
//  Serial.print(card.errorCode(), HEX);
//  putstring(", ");
//  Serial.println(card.errorData(), HEX);
//  while(1);
//}
void talkISR()
{
 
playfile ("tti.WAV");

}
void loop() {
 
  //playcomplete ("gdmor.wav");
  dispTemp();
  dispTime();   
}

ISR(TIMER3_COMPA_vect) //timer3 interrupt service routine
{
    sens++;
    sec1++;
    //dispTime();
    if (sens ==2)
    {
      sens=0;
      reading = analogRead(sensorPin);
      voltage = reading;

    // Temperature conversion to Celsius

     temp = (voltage*5.0*100.0) /1024.0; //conversion using the 5V input pin
    }
    if (sec1 > 9)
    {
      sec1=0;
      sec++;
    }
    if (sec>1)  //if seconds greater than 20 seconds.
    {
      sec=0;
      sec1=0;
      mn1++;
    }
    if (mn1 > 1)
    {
      mn1 = 0;
      mn++;
    }
    if (mn > 2)
    {
      mn = 0;
      hr1++;
    }
    if (hr1 > 1)
    {
      hr1=0;
      hr++;
    }
    if (hr>2)
    {
      hr=0; hr1=0; mn=0; mn1=0; sec=0; sec1=0;
    }
   
//dispTime();
}

void dispTime ()
{
  lcd.setCursor (0,1);
  lcd.print ("                    ");
  lcd.setCursor (14, 1);
  lcd.print (sec1);
  lcd.setCursor (13, 1);
  lcd.print (sec);
  lcd.setCursor (12, 1);
  lcd.print (":");
  lcd.setCursor (11, 1);
  lcd.print (mn1);
  lcd.setCursor (10,1);
  lcd.print (mn);
  lcd.setCursor (9,1);
  lcd.print (":");
  lcd.setCursor (8,1);
  lcd.print (hr1);
  lcd.setCursor (7,1);
  lcd.print (hr);     
}

void dispTemp ()
{
  if (temp > 100)
  {
    lcd.setCursor (0,3);
    lcd.print ("                    ");
  }
  else {
        lcd.setCursor (0,3);
        //lcd.print ("                    ");
        lcd.print("Current temp ");
        lcd.print(temp);
        lcd.print((char)223); //degree character
        lcd.print("C");
  }
 
  delay(1000);  //update every second
}
   



// Plays a full file from beginning to end with no pause.
void playcomplete(char *name) {
  // call our helper to find and play this name
  playfile(name);
  while (wave.isplaying) {
  // do nothing while its playing
  }
  // now its done playing
}

void playfile(char *name) {
  // see if the wave object is currently doing something
  if (wave.isplaying) {// already playing something, so stop it!
    wave.stop(); // stop it
  }
  // look in the root directory and open the file
  if (!f.open(root, name)) {
    putstring("Couldn't open file "); Serial.print(name); return;
  }
  // OK read the file and turn it into a wave object
  if (!wave.create(f)) {
    putstring_nl("Not a valid WAV"); return;
  }
 
  // ok time to play! start playback
  wave.play();
}
Lastborn
 
Posts: 28
Joined: Mon Jul 23, 2012 9:01 am

Re: Wave Sheild Odd Issue

Postby fat16lib » Mon Jul 30, 2012 10:38 am

How are you able to use pins 11, and 12 for the lcd? Have you cut the traces on the wave shield? Are pins 11 and 12 still on the Wave Shield? How are the SPI wires installed?

How did you remap the DAC pins? Some Mega pins may not work with the DAC because they are too slow. pins 6, 7, 8, and 9 are on Mega Port H which is slow.
fat16lib
 
Posts: 586
Joined: Wed Dec 24, 2008 12:54 pm

Re: Wave Sheild Odd Issue

Postby Lastborn » Mon Jul 30, 2012 6:10 pm

This is how I remapped my circuit.
The sd card communication interface was remapped as 10-->53, 11-->51, 12-->50, 13-->52.

The DAC control pins were modified in the wavepins defs.h, so I'm using pins 22,23,24,25 on the arduino mega. I grounded the LDAC pin -- 25.

The lcd uses pins (12,11,5,4,3,2) for communication. I cut off the pin headers for 12 and 11 on the wave shield so that I can use them with the LCD. I don't suppose it affects the wave shield in anyway.

At first I thought the problem came from my software. The LCD works without the wave shield codes and vice versa but the LCD stops working/displays random digits when I incorporate the wave shield codes. I don't see any obvious problem but I pasted my codes earlier in this thread. Thank you :)
Lastborn
 
Posts: 28
Joined: Mon Jul 23, 2012 9:01 am

Re: Wave Sheild Odd Issue

Postby fat16lib » Mon Jul 30, 2012 10:31 pm

I still don't understand how you connect pins 11 and 12 to the LCD without cross connecting with SPI on the Wave Shield.

How do you wire the Shield SPI to Mega pins 50-53 and the LCD to Mega pins 11, 12 without a problem?
fat16lib
 
Posts: 586
Joined: Wed Dec 24, 2008 12:54 pm

Re: Wave Sheild Odd Issue

Postby Lastborn » Tue Jul 31, 2012 9:22 am

Hi. I thought since I clipped off the header pins 11 and 12 going from the wave shield into the MEGA, there'd be no problem. It said somewhere on the adafruit website that pins 11,12 and 13 on the wave shield can't be changed. I don't know about the LCD pins. Can I change them?
Lastborn
 
Posts: 28
Joined: Mon Jul 23, 2012 9:01 am

Re: Wave Sheild Odd Issue

Postby Lastborn » Tue Jul 31, 2012 9:42 am

Image

That's how it's wired presently with pins 12 and 11 for the LCD.
Lastborn
 
Posts: 28
Joined: Mon Jul 23, 2012 9:01 am

Re: Wave Sheild Odd Issue

Postby Lastborn » Thu Aug 02, 2012 5:43 am

I found the problem. The wave shield is working perfectly with my LCD interface now. Thanks a lot.
So on my Mega, I remapped the lcd pins to (47,33, 2,3,4,5). Note the order of connection of the lcd pins is quite specific. Pins 47 and 33 are the alternatives to the RS and Enable pins (12, 11). You can probably find others that might work.
Lastborn
 
Posts: 28
Joined: Mon Jul 23, 2012 9:01 am

Re: Wave Sheild Odd Issue

Postby Lastborn » Wed Aug 15, 2012 8:25 am

So I just finished my Speaking Clock project. Any chance this could be featured on Adafruit?
Here's a link: http://www.youtube.com/watch?v=EeK6Wdch ... e=youtu.be
Lastborn
 
Posts: 28
Joined: Mon Jul 23, 2012 9:01 am

Re: Wave Sheild Odd Issue

Postby adafruit_support_rick » Wed Aug 15, 2012 9:26 am

Hey! Well done! Congratulations!
User avatar
adafruit_support_rick
 
Posts: 2881
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Wave Sheild Odd Issue

Postby Lastborn » Wed Aug 15, 2012 3:52 pm

Thank you. And thanks for the help and support.
Lastborn
 
Posts: 28
Joined: Mon Jul 23, 2012 9:01 am

Previous

Return to Arduino Shields from Adafruit

Who is online

Users browsing this forum: Google [Bot], MSN [Bot] and 5 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [102]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]