Shop OBEX P1 Docs P2 Docs Learn Events
Parallax 2x16 Serial LCD Backlit, with Speaker #27977-RT — Parallax Forums

Parallax 2x16 Serial LCD Backlit, with Speaker #27977-RT

ArduitoArduito Posts: 4
edited 2012-12-22 11:06 in General Discussion
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 Arduino 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 FIRST QUESTION: Does anyone know or have suggestions of an easier way of doing steps 2 and 3?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 link above for Decimal Command Codes:

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?
Code and image below:
[COLOR=#000000][FONT=courier new]const int TxPin = 6;[/FONT][/COLOR]

[COLOR=#000000][FONT=courier new]#include <SoftwareSerial.h>[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]SoftwareSerial mySerial = SoftwareSerial(255, TxPin);[/FONT][/COLOR]

[COLOR=#000000][FONT=courier new]void setup() {[/FONT][/COLOR]

[COLOR=#000000][FONT=courier new]  pinMode(TxPin, OUTPUT);[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  digitalWrite(TxPin, HIGH);[/FONT][/COLOR]

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

[COLOR=#000000][FONT=courier new]  mySerial.write(216);                // Select the 4th scale (A = 440Hz)[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  /* [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  Scale  A    A#  B    C    C#   D    D#   E    F    F#   G    G#[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  4      440  466 494  523  554  587  622  659  698  740  784  831 [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  */[/FONT][/COLOR]

[COLOR=#000000][FONT=courier new]//16[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(212);                // 1/4 note [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(220);                // A tone  [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]//17[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(212);                // 1/4 note[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(228);                // F tone  [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]//18[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(212);                // 1/4 note[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(227);                // E tone  [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]//19[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(212);                // 1/4 note[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(225);                // D tone  [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]//20[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(211);                // 1/8 note (this should be 3/16, but I don't know the “set length” command for it)[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(222);                // B tone  [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]//21[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(210);                // 1/16 note  [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(222);                // B tone  [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]//22[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(212);                // 1/4 note[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(220);                // A tone  [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]//23[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(212);                // 1/4 note[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(228);                // F tone  [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]//24[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(212);                // 1/4 note[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(230);                // G tone  [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]//25[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(213);                // 1/2 note (this should be 3/4, but I don't know the “set length” command for it) [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(228);                // F tone  [/FONT][/COLOR]

[COLOR=#000000][FONT=courier new]  delay(3000);                        // Wait 3 seconds[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]  mySerial.write(18);                 // Turn backlight off[/FONT][/COLOR]

[COLOR=#000000][FONT=courier new]}[/FONT][/COLOR]

[COLOR=#000000][FONT=courier new]void loop() {[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]}[/FONT][/COLOR]
Happy Birthday.jpg
637 x 824 - 107K

Comments

Sign In or Register to comment.