'{$STAMP BS2p} '*********************************************************** '** ** '** I2C Routines for the Basic Stamp BS2p ** '** Controlling SP03 Speech Synthesizer ** '** ** '** Copyright 2002 - Devantech Ltd ** '** Commercial use of this software is prohibited ** '** Private and educational use only is permitted ** '** ** '** Written by Gerald Coe - August 2002 ** '** ** '*********************************************************** SCL con 9 ' I2C clock SDA con 8 ' I2C data NOP con 0 ' No Operation command status var byte Main: ' The following shows how easy it is to use the BS2p with the Speech Module, ' a single line command is all that is required to speak any of the 30 ' pre-loaded phrases. The example below shows how to speak phrase number 21. i2cout SDA, $c4, 0, [21] ' speak phrase number 21 ' You can also send your own Text to Speech messages to the module to be spoken. ' The first data byte is the command, in this case a NOP, since we just need to ' load the buffer. The 2nd value is Volume (0-7) which works backwards - 0 is ' loudest and 7 is quiet. The 3rd value is Pitch (0-7) which it is best to just ' try it and see. The 4th value is Speed (0-3) with 3 being fastest. ' You then place the text you wish spoken in inverted comma's and finally the ' $1a character and a 0. gosub wait4shutup ' wait for last phrase to finish speaking i2cout SDA, $c4, 0, [NOP, 0,5,3, "Hello Gerry, How are u today", $1a, 0] ' The above loads the modules internal buffer. You then need to send a command to ' speak the phrase you just loaded. i2cout SDA, $c4, 0, [$40] ' And thats it. ' The following completes the program so that you can run it. forever: goto forever wait4shutup: i2cin SDA, $c4, 0, [status] if status>0 then wait4shutup return