Pages: [1]   Go Down
Author Topic: Parallax 2x16 Serial LCD Backlit, with Speaker #27977-RT  (Read 4231 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone,
I just bought the subject item at Fry's Electronics:
http://www.frys.com/product/6726995;jsessionid=jChdtuzzoKANrd8+LpeFyQ__.node2?site=sr:SEARCH:MAIN_RSLT_PG.
  Mfr: PARALLAX
  Parallax Model: 27977-RT
  FRYS.com #6726995
  UPC: 644890279773

And using the info I found at parallax.com
Ardunio example:http://learn.parallax.com/kickstart/27977
Decimal Command Codes:http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/27976-7-9-ParallaxSerialLCD-v3.0.pdf
Musical Notes:http://forums.parallax.com/showthread.php?139362-Parallax-2x16-Serial-LCD-(27977)-Backlit-w-Spkr-Example-Prop-snd-SPIN-code

I was able to make a Happy Birthday song by doing the following.
1)Found the musical notes for the song on the internet. http://www.8notes.com/scores/1110.asp
2)Converted the notes to decimal command codes (both lenghth and tone) (see image below).
3)Typed it into the IDE (see code below).
4) Uploaded to the Arduino UNO.

Steps 1 and 4 are fairly easy, but steps 2 and 3 were very time consuming. 
MY QUESTION:   Anyone know or have suggestions of an easier way of doing steps 2 and 3?

I've included the code and image.
Code:
const int TxPin = 6;

#include <SoftwareSerial.h>
SoftwareSerial mySerial = SoftwareSerial(255, TxPin);

void setup() {
   
  pinMode(TxPin, OUTPUT);
  digitalWrite(TxPin, HIGH);
 
  mySerial.begin(9600);
  delay(100);
  mySerial.write(12);                 // Clear             
  mySerial.write(17);                 // Turn backlight on
  delay(5);                           // Required delay
  mySerial.print("Happy Birthday");  // First line
  mySerial.write(13);                 // Form feed
  mySerial.print("Happy Birthday");   // Second line
  mySerial.write(216);                // Select the 4th scale (A = 440Hz)
  /*
  Scale  A    A#  B    C    C#   D    D#   E    F    F#   G    G#
  4      440  466 494  523  554  587  622  659  698  740  784  831
  */
//1
  mySerial.write(211);                // 1/8 note (this should be 3/18, but I don't know the “set length” command for it)
  mySerial.write(223);                // C tone
//2 
  mySerial.write(210);                // 1/16 note 
  mySerial.write(223);                // C tone
//3 
  mySerial.write(212);                // 1/4 note
  mySerial.write(225);                // D tone
//4 
  mySerial.write(212);                // 1/4 note
  mySerial.write(223);                // C tone
//5
  mySerial.write(212);                // 1/4 note 
  mySerial.write(228);                // F tone 
//6
  mySerial.write(213);                // 1/2 note 
  mySerial.write(227);                // E tone 
//7
  mySerial.write(211);                // 1/8 note (this should be 3/18, but I don't know the “set length” command for it) 
  mySerial.write(223);                // C tone
//8
  mySerial.write(210);                // 1/16 note 
  mySerial.write(223);                // C tone
//9
  mySerial.write(212);                // 1/4 note
  mySerial.write(225);                // D tone
//10
  mySerial.write(212);                // 1/4 note
  mySerial.write(223);                // C tone
//11
  mySerial.write(212);                // 1/4 note
  mySerial.write(230);                // C tone
//12
  mySerial.write(213);                // 1/2 note   
  mySerial.write(228);                // F tone 
//13
  mySerial.write(211);                // 1/8 note (this should be 3/18, but I don't know the “set length” command for it) 
  mySerial.write(223);                // C tone
//14
  mySerial.write(210);                // 1/16 note 
  mySerial.write(223);                // C tone 
  mySerial.write(217);              // Select the 5th scale (A = 880Hz)
  /*
  Scale  A    A#  B    C    C#   D    D#   E    F    F#   G    G#
  5      880  932 988  1047 1109 1175 1245 1319 1397 1480 1568 1661 
  */
//15
  mySerial.write(212);                // 1/4 note
  mySerial.write(223);                // C tone
 
  mySerial.write(216);                // Select the 4th scale (A = 440Hz)
  /*
  Scale  A    A#  B    C    C#   D    D#   E    F    F#   G    G#
  4      440  466 494  523  554  587  622  659  698  740  784  831
  */
 
//16
  mySerial.write(212);                // 1/4 note
  mySerial.write(220);                // A tone 
//17
  mySerial.write(212);                // 1/4 note
  mySerial.write(228);                // F tone 
//18
  mySerial.write(212);                // 1/4 note
  mySerial.write(227);                // E tone 
//19
  mySerial.write(212);                // 1/4 note
  mySerial.write(225);                // D tone 
//20
  mySerial.write(211);                // 1/8 note (this should be 3/18, but I don't know the “set length” command for it)
  mySerial.write(222);                // B tone 
//21
  mySerial.write(210);                // 1/16 note 
  mySerial.write(222);                // B tone 
//22
  mySerial.write(212);                // 1/4 note
  mySerial.write(220);                // A tone 
//23
  mySerial.write(212);                // 1/4 note
  mySerial.write(228);                // F tone 
//24
  mySerial.write(212);                // 1/4 note
  mySerial.write(230);                // G tone 
//25
  mySerial.write(213);                // 1/2 note (this should be 3/4, but I don't know the “set length” command for it)
  mySerial.write(228);                // F tone 

  delay(3000);                        // Wait 3 seconds
  mySerial.write(18);                 // Turn backlight off

}

void loop() {
}

 


* Happy Birthday.jpg (107.39 KB, 637x824 - viewed 93 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Correction to the comments in the code of the OP.
The comment for notes //1, //7, //13 & //20 should be 3/16 not 3/18.

I was unable to figure out how to set the length of a note to 3/16 or 3/4.

Here's the list I found, as noted in the OP link for Decimal Command Codes:
http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/27976-7-9-ParallaxSerialLCD-v3.0.pdf
Dec   Hex   Action
208   D0   Set note length to 1/64 note
209   D1   Set note length to 1/32 note
210   D2   Set note length to 1/16 note
211   D3   Set note length to 1/8 note
212   D4   Set note length to 1/4 note
213   D5   Set note length to 1/2 note
214   D6   Set note length to whole note (2 seconds)


MY SECOND QUESTION:  Does anyone know how to set the length of a note to 3/16 and 3/4?
Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2574
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Declare a bunch of constants, make an array of notes, and then use switch..case?

Why would you use that device with Arduino though?

http://arduino.cc/en/Reference/Tone

http://arduino.cc/en/Tutorial/Tone
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Declare a bunch of constants, make an array of notes, and then use switch..case?
...
http://arduino.cc/en/Reference/Tone

http://arduino.cc/en/Tutorial/Tone
Thanks, I will look into those links.

...
Why would you use that device with Arduino though?
...
Because the Parallax brand items are the devices that are available at the Fry's Electronics store.  I assumed it was OK because the Parallax packaging stated that it was compatible with the Arduino.

Are you implying that I shouldn't use it with the Arduino? If so, why not?
Just simply asking because I truly want to know smiley I'm new to Audrino and wasn't aware of what I shouldn't use with it.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As a follow-up.
I also purchased the Parallax standard servos, Parallax continous rotation servos, and a Parallax joystick.  

Am I going down the wrong road?
Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2574
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's not a Parallax bash.
The servos and joystick are fine.
I like that their LCDs work with asynchronous serial instead of I2C or SPI (which is the Arduino trip), but you'll have to use SoftwareSerial or there could be conflicts in having it connected to D0 & D1 when uploading.

Since the Arduino is capable of doing "music" (via Tone) on its own, as it is, what then is to be gained by buying something else to do that with?
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Am I going down the wrong road?

I don't think you are going down the wrong road. It's just the only road you have. i too have the same #27977-RT LCD and am trying to figure out how to make it work. I don't think it is the wrong or right road, it is just the only road i have right now. Good for you on the HBD song but be careful the copywright monsters might chase you down LOL
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

now we just need zelda (nes)
Logged

Pages: [1]   Go Up
Jump to: