Sorry, this shoutbox does not exist.

Author Topic: DFRduino Player connect to atmega128  (Read 1736 times)

pandora

  • Jr. Member
  • **
  • Posts: 10
  • Karma: +0/-0
DFRduino Player connect to atmega128
« on: April 24, 2012, 12:20:19 am »
Hello,

I have atmega128 and DFRduino Player. Connections and sd card is correct.
I want to play player only with atmega128, not with the terminal, can I ?
I've tried to program it, but to a dead end. Can you help me to program it ?

sorry if my english so bad.

thank you very much.

Ricky

  • Administrator
  • Hero Member
  • *****
  • Posts: 283
  • Karma: +7/-0
    • Follow us on Twitter for coupons and product updates!
Re: DFRduino Player connect to atmega128
« Reply #1 on: April 24, 2012, 10:07:12 am »
Yes. You can do it as long as the atmega 128 supports either i2c or serial interface.

Once you wire the Atmega128, you can send I2C command or serial command to player. 

The player accepts the same strings you used to send in your terminal. You can refer to our Arduino code, it has the same principle.

http://www.dfrobot.com/wiki/index.php?title=DFRduino_Player_(SKU:DFR0112)
Follow us on TWITTER for announcements of specials and product updates! Along with interesting open source robotics news!

pandora

  • Jr. Member
  • **
  • Posts: 10
  • Karma: +0/-0
Re: DFRduino Player connect to atmega128
« Reply #2 on: April 25, 2012, 11:42:47 am »
thank for the reply ricky.

i've tried several possibilities, but it still not work.
this is my code :

Code: [Select]
while (1)
      {
        lcd_clear();
        lcd_gotoxy(3,0);
        lcd_putsf(".::Ready::.");
        lcd_gotoxy(0,1);
        lcd_putsf("DFRduino Player");
        delay_ms(5000);
        lcd_clear();
        lcd_gotoxy(3,0);
        lcd_putsf(".::Play::.");
        printf("\\:s\r\n");
        printf("\\:v 255\r\n");
        printf("\\01");
        test[0] = getchar();
        test[1] = getchar();
        sprintf (lcd_buffer,"%s",test);
        lcd_gotoxy(0,1);
        lcd_puts(lcd_buffer);
        while (1);
       
      };
}

Hector

  • Not an
  • Hero Member
  • *****
  • Posts: 788
  • Karma: +21/-2
    • Follow us on Twitter for coupons and product updates!
Re: DFRduino Player connect to atmega128
« Reply #3 on: May 02, 2012, 01:50:30 pm »
Hi Pandora,


You should try to modify the sample code provided on the wiki first.


I would recommend to modify the play command first. When you get that one working, you can modify the rest.
 
What will you use to trigger a change? A sensor, a button?




This is the command you should be using along with the library.

TwiSend("\\:s\r\n");
Serial.println("OK");
-Hector

Follow us on TWITTER for announcements of specials and product updates! Along with interesting open source robotics news!

pandora

  • Jr. Member
  • **
  • Posts: 10
  • Karma: +0/-0
Re: DFRduino Player connect to atmega128
« Reply #4 on: May 09, 2012, 10:58:33 pm »
Thank for the reply hector, very helpful.

Finally, player can work. I add a push button to play player.
I was wrong earlier in the program. I'm using the usart, transmitter interrupt, and mistake setting baud rate.

this my update code :
Code: [Select]
DDRA.1 = 1; //Push Button
DDRB.1 = 1; //LED
PORTB.1 = 1; //LED off

while (1)
      {
        if (PINA.1 == 1)
        {
                PORTB.1 = 0; //LED ON
                printf("\\:s\r\n");
                printf("\\:v 255\r\n");
                printf("\\japan\r\n");
                while (PINA.1 == 1);
        }
      };
}

usart connection diagram on the wiki is it true? when I followed the instructions did not work. I switch the connection was working.

And my player is working now, but the song always stop in the middle of playing or error stuck in the middle of playing. Can you help me?

Hector

  • Not an
  • Hero Member
  • *****
  • Posts: 788
  • Karma: +21/-2
    • Follow us on Twitter for coupons and product updates!
Re: DFRduino Player connect to atmega128
« Reply #5 on: May 10, 2012, 10:31:15 am »
Hi,


I have not encountered a problem with the song stopping half way. Are you using batteries? Maybe the batteries are too low, you should change them.


make sure the program is not sending any extra data that might cause the player to stall. Maybe the button is unstable, if another push is detected then the sequence is repeated, but the play command also serves as the pause command. so maybe it is  pausing.
-Hector

Follow us on TWITTER for announcements of specials and product updates! Along with interesting open source robotics news!

pandora

  • Jr. Member
  • **
  • Posts: 10
  • Karma: +0/-0
Re: DFRduino Player connect to atmega128
« Reply #6 on: May 10, 2012, 11:43:25 am »
Okay I will try to fix it.
Can I add speaker in every port? I tried adding second speaker, and then make green LED flashing.

Edit : all problem solved, adding speaker, problem with the song stopping half way, just replace a new battery all the work. thank hector and ricky.

This pin is usefull for what? (marked in red)
« Last Edit: May 10, 2012, 12:52:39 pm by pandora »

Ricky

  • Administrator
  • Hero Member
  • *****
  • Posts: 283
  • Karma: +7/-0
    • Follow us on Twitter for coupons and product updates!
Re: DFRduino Player connect to atmega128
« Reply #7 on: May 10, 2012, 02:39:41 pm »
Okay I will try to fix it.
Can I add speaker in every port? I tried adding second speaker, and then make green LED flashing.

Edit : all problem solved, adding speaker, problem with the song stopping half way, just replace a new battery all the work. thank hector and ricky.

This pin is usefull for what? (marked in red)



Can not see the image! You can upload the image here.
Follow us on TWITTER for announcements of specials and product updates! Along with interesting open source robotics news!

pandora

  • Jr. Member
  • **
  • Posts: 10
  • Karma: +0/-0
Re: DFRduino Player connect to atmega128
« Reply #8 on: May 10, 2012, 03:01:51 pm »
ah sorry, it can upload here

Hector

  • Not an
  • Hero Member
  • *****
  • Posts: 788
  • Karma: +21/-2
    • Follow us on Twitter for coupons and product updates!
Re: DFRduino Player connect to atmega128
« Reply #9 on: May 10, 2012, 04:41:16 pm »
This is the ICSP header which is used to re-program the AVR's Firmware. If you do this you will break the player's functionality. You shouldn't need to use this.



-Hector

Follow us on TWITTER for announcements of specials and product updates! Along with interesting open source robotics news!

 

SimplePortal 2.3.4 RC1 © 2008-2011, SimplePortal