Shop OBEX P1 Docs P2 Docs Learn Events
DEMO: Arduino_light plays old school tunes on Quickstart board — Parallax Forums

DEMO: Arduino_light plays old school tunes on Quickstart board

pedwardpedward Posts: 1,642
edited 2013-03-16 05:55 in Propeller 1
I wanted to demonstrate how to use the Arduino_light SPIN object, beyond the unit tests, so I ported a tune player from the Arduino forum.

The demo program here http://obex.parallax.com/objects/download/aux/168/ has several tunes like the Simpsons theme, Mission Impossible,
and several Super Mario Brothers themes.

You can plug a little speaker (giftcard speakers are great) into the quickstart header and listen to the Propeller sound like someone set off
all of the cards in the Hallmark section at Wal-Mart! :lol:

Comments

  • doggiedocdoggiedoc Posts: 2,243
    edited 2011-12-07 19:42
    Looking forward to experimenting with your object! Sounds exciting. Right now I am tinkering with Martin Hodge's PASC+ and an Arduino Ethernet Shield.

    Thanks for a great object!

    Paul
  • pedwardpedward Posts: 1,642
    edited 2011-12-07 19:48
    FWIW, the Arduino Ethernet Shield uses the same chip as the Parallax Wiznet plugin module. What that means to you is that you can get the driver that the Spinneret uses to talk to the Ethernet shield. Just thought I'd share in case you didn't know.
  • jazzedjazzed Posts: 11,803
    edited 2011-12-07 19:50
    Looks great :) Love those ring tone songs. Lots of people use ring tone format in simple games.
    pedward wrote: »
    I wanted to demonstrate how to use the Arduino_light SPIN object, beyond the unit tests, so I ported a tune player from the Arduino forum.

    The demo program here http://obex.parallax.com/objects/download/aux/168/ has several tunes like the Simpsons theme, Mission Impossible,
    and several Super Mario Brothers themes.

    You can plug a little speaker (giftcard speakers are great) into the quickstart header and listen to the Propeller sound like someone set off
    all of the cards in the Hallmark section at Wal-Mart! :lol:
  • doggiedocdoggiedoc Posts: 2,243
    edited 2011-12-07 19:54
    pedward wrote: »
    FWIW, the Arduino Ethernet Shield uses the same chip as the Parallax Wiznet plugin module. What that means to you is that you can get the driver that the Spinneret uses to talk to the Ethernet shield. Just thought I'd share in case you didn't know.
    Good info thanks!
  • pedwardpedward Posts: 1,642
    edited 2011-12-07 22:20
    I added another demo that uses the Arduino_light object to play a WAV file. The demo takes each 8 bit sample and stuffs it directly into analogWrite() to produce a digitized output. The demo is here http://obex.parallax.com/objects/download/aux/169/

    It is a short sample 8bit 8Khz unsigned PCM RAW of Arnold in Terminator saying "I'll be back".

    This isn't really new, but it is just something to get people excited and is something to start with to do even neater things (like 16 Arnolds chattering away?).
  • mindrobotsmindrobots Posts: 6,506
    edited 2011-12-08 00:23
    Pedward,

    Great work!
    The avatar is classic, too!
  • Ahle2Ahle2 Posts: 1,179
    edited 2011-12-08 13:04
    Why is it called Arduino_light; Will you do an "Arduino_not_light" version later?
    What's the reason for an Arduino object on the Propeller; To lure "Arduino people" to the Propeller?

    /Johannes
  • pedwardpedward Posts: 1,642
    edited 2011-12-08 13:55
    Ahle2 wrote: »
    Why is it called Arduino_light; Will you do an "Arduino_not_light" version later?
    What's the reason for an Arduino object on the Propeller; To lure "Arduino people" to the Propeller?

    /Johannes

    The purpose is to give people who are familiar with the Arduino something to start with. To be honest, SPIN and the OBEX continuum don't offer the most user friendly experience. For that matter, anyone looking to do simple stuff like make beeps and boops, this definitely offers a simpler interface than programming the counter directly. Even the CTR object is obtuse and not beginner friendly. All I've done is re-implement all of the basic stuff in one place, wrapped in an API that is already well established and supported by another platform.

    I called it "light" because if there demand, I may create an Arduino_full that is more completely compatible. This would use a supervisor COG to implement counter overflow detection, perhaps interrupts (if I can figure out how to do it properly), and tone duration control.
  • skylightskylight Posts: 1,915
    edited 2011-12-11 07:49
    Great work pedward, just one question does the "giftcard speaker" need an inline resistor to prevent damage to the I/O's?
  • pedwardpedward Posts: 1,642
    edited 2011-12-11 09:36
    I suppose you could install a 100 ohm resistor in series to limit current. I didn't bother and just plugged the 8 ohm speaker into the port pins. I'm sure others could go into great detail, but I don't think it will hurt the chip to toy with it.
  • pedwardpedward Posts: 1,642
    edited 2011-12-12 13:11
    I just took a video of the Propeller playing a WAV file with the Arduino_light object. It's playing 8-bit PCM at 11025Hz. The output sounds very good, even without blocking/smoothing caps.

    http://youtu.be/9GgY98Y4b2k
  • skylightskylight Posts: 1,915
    edited 2013-03-15 16:18
    Downloaded the spin program some time ago before I got my quickstart and now i've got into spin a bit I notice the program uses the Arduino_light object but the download doesn't contain the object and a search for it on the obex came up with nothing, where can you find the object?
  • skylightskylight Posts: 1,915
    edited 2013-03-16 05:55
    Thanks pedward
Sign In or Register to comment.