| SP03 to OOPic Example Last Modified: 2006-10-26 | | |
| Acroname Robotics | PDF webpage version | ||
| ![]() Introduction In this example, an OOPic module uses a Devantech SP03 Speech Module to say pre-programmed phrases. Circuit Schematic In the following schematic, the SP03 is connected to the OOPic's I2C bus through its empty EEPROM socket, which also provides power and ground. ![]() A close-up of the ends of the custom interface cable built for this example is shown below. The wires on the 2-pin male connector are SDA (denoted by black tape) and SCL. The red wire is ground. The other wire is +5V. Each wire has a female connector placed in the appropriate slot in the black housing. The black housing connects to the SP03. The male ends fit into the EEPROM socket. ![]() Source Code This code uses BASIC syntax. It runs with version 5.0.1 of the OOpic compiler and version A.1.7 of the OOPic chip. The OOPic oI2C object provides an interface for the SP03. The sayphrase subroutine initializes the I2C communication and sends a command across the bus to make the SP03 speak one of its 30 stored phrases. The routine polls the SP03 module to find out when it has completed saying the phrase. Stored phrases are convenient for common messages. For a robot, some examples might be "ouch", "hello master", or "my batteries are low". ' Filename: sp03-2.osc
' This program uses the I2C Object
' to communicate with a Devantech SP03
dim SP03Link as new oI2C
dim i as new oByte
sub main()
' endlessly repeat first 6 stored phrases
do
for i=1 to 6
call sayphrase(i)
next i
loop
end sub
' writes command to speak a stored phrase
' SP03 address is 0xC4 (196), OOPic uses 0xC4/2 (98)
' after sending command, polls until phrase is complete
sub sayphrase(n as byte)
SP03Link.Node=98
SP03Link.NoInc=cvFalse
SP03Link.Mode=cv10bit
SP03Link.Width=cv8bit
SP03Link.Location=0
SP03Link.Value=n
while (SP03Link.Value>0)
wend
end sub
Revision History
| ||||
Related Links: BrainStem Console Getting Started Guide for Devantech SP03 Connections | |||||
| voice: 720-564-0373, email: sales@acroname.com, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy © Copyright 1994-2010 Acroname, Inc., Boulder, Colorado. All rights reserved. |