Question About Parallax 2 x 16 LCD
NWCCTV
Posts: 3,629
I have this LCD. In the product description it states there is a built in Piezo speaker for combining sounds with the display. Does anyone have any Spin code that uses the Piezo speaker? I looked in the OBEX and did not see anything. I would like to add this to my WT and have it make sounds while displaying data.

Comments
dgately
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 TX_PIN = 1 BAUD = 19_200 LCD_BKSPC = $08 ' move cursor left LCD_RT = $09 ' move cursor right LCD_LF = $0A ' move cursor down 1 line LCD_CLS = $0C ' clear LCD (follow with 5 ms delay) LCD_CR = $0D ' move pos 0 of next line LCD_BL_ON = $11 ' backlight on LCD_BL_OFF = $12 ' backlight off LCD_OFF = $15 ' LCD off LCD_ON1 = $16 ' LCD on; cursor off, blink off LCD_ON2 = $17 ' LCD on; cursor off, blink on LCD_ON3 = $18 ' LCD on; cursor on, blink off LCD_ON4 = $19 ' LCD on; cursor on, blink on LCD_LINE0 = $80 ' move to line 1, column 0 LCD_LINE1 = $94 ' move to line 2, column 0 LCD_LINE2 = $A8 ' move to line 3, column 0 LCD_LINE3 = $BC ' move to line 4, column 0 LCD_CC0 = $F8 ' define custom char 0 LCD_CC1 = $F9 ' define custom char 1 LCD_CC2 = $FA ' define custom char 2 LCD_CC3 = $FB ' define custom char 3 LCD_CC4 = $FC ' define custom char 4 LCD_CC5 = $FD ' define custom char 5 LCD_CC6 = $FE ' define custom char 6 LCD_CC7 = $FF ' define custom char 7 nl64th = 208 'note length 1/64th nl32nd = 209 '1/32nd nl16th = 210 '1/16th nl8th = 211 '1/8th nlqtr = 212 'qtr nlhalf = 213 'half nlwhole = 214 'whole nscl3 = 215 '3rd scale (A=220Hz) nscl4 = 216 '4th scale (A=440Hz) nscl5 = 217 '5th scale (A=880Hz) nscl6 = 218 '6th scale (A=1760Hz) nscl7 = 219 '7th scale (A=3520Hz) ntA = 220 'A ntAs = 221 'A sharp ntB = 222 'B ntC = 223 'C ntCs = 224 'C sharp ntD = 225 'D ntDs = 226 'D sharp ntE = 227 'E ntF = 228 'F ntFs = 229 'F sharp ntG = 230 'G ntGs = 231 'G sharp ntPause = 232 'pause for current note length OBJ LCD : "FullDuplexSerial.spin" PUB Main | idx LCD.start(TX_PIN, TX_PIN, %1000, 19_200) waitcnt(clkfreq / 100 + cnt) ' Pause for FullDuplexSerial.spin to initialize lcd.tx(LCD_CLS) waitcnt(clkfreq / 100 + cnt) lcd.tx(LCD_BL_ON) ' backlight on ' messing with music repeat idx from 0 to 9 lcd.tx(muzak[idx]) repeat idx from 0 to 9 lcd.tx(muzak2[idx]) repeat 10 ' flash blacklight (again, more playing with code) lcd.tx(LCD_BL_OFF) waitcnt(clkfreq / 40 + cnt) lcd.tx(LCD_BL_ON) waitcnt(clkfreq / 5 + cnt) DAT Muzak byte 215, 210, 216, 220, 226, 230, 217, 226, 230, 220 ' 1/16, 4th, A , D#, G, 5th, D# , G , A Muzak2 byte 215, 210, 216, 220, 220, 220, 211, 220, 220, 220 ' 1/16, 4th, A , A , A , 1/8, A , A , A