Shop OBEX P1 Docs P2 Docs Learn Events
Having Trouble Converting Code from Basic To Javelin - For Sound Module — Parallax Forums

Having Trouble Converting Code from Basic To Javelin - For Sound Module

JoeSchmoeJoeSchmoe Posts: 2
edited 2005-05-09 02:08 in General Discussion
I have just switched over to Javelin from PBasic and am having trouble with the "Sound Module" that Parallax supplied with user instructions that are only in PBasic.
Their PBasic program is listed below:


x var byte ‘loop counter
Init: pause 500 ‘wait for power up
serout 4,84+$8000,[noparse][[/noparse]"!SM0N"] 'Enable recording
pause 500 'Wait a little time
Start: for x = 0 to 3 'For 3 different addresses:
serout 4,84+$8000,[noparse][[/noparse]"!SM0R",(X*5)] 'Record a message
pause 1950 'for 1.95 seconds
serout 4,84+$8000,[noparse][[/noparse]"!SM0E"] 'then End recording
pause 1000 'and one second later
serout 4,84+$8000,[noparse][[/noparse]"!SM0P",(X*5)] 'Play that message back
pause 2000 'Wait for message
next 'repeat until done
for x = 0 to 3
serout 4,84+$8000,[noparse][[/noparse]"!SM0P",(X*5)] ' Play 3 messages back
pause 2000
next
end







I wrote a small program to try to communicate the first command and nothing happened.


import stamp.core.*;
public class EnableRecording { // COM Port (9-pin serial)
final static int SERIAL_TX_PIN = CPU.pin4; // 2

static Uart txUart = new Uart( Uart.dir mit, SERIAL_TX_PIN, Uart.dontInvert,
Uart.speed9600, Uart.stop1 );

public static void main(){
CPU.delay(500);
txUart.sendString("!SMON");
} // end main
}



Parallax's manual for the "Sound Module" is located at:

http://www.parallax.com/dl/docs/prod/appmod/soundmodule.pdf


freaked.gif

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-05-08 09:08
    CPU.delay(105) delays 10 msec

    for 500 msec (eg. pause 500) use CPU.delay(5250);

    If that doesn't do the trick, try using Uart.invert

    instead of Uart.dontInvert

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-05-08 09:14
    Also,

    the command is !SM0N, not !SMON

    (a zero, not a capital o)
    From thie listing it appears you type a capital o.
    regards peter
    ·
  • JoeSchmoeJoeSchmoe Posts: 2
    edited 2005-05-09 02:08
    Peter, you saved my Sunday!

    Joe
Sign In or Register to comment.