Text control

The most versatile and user friendly E-Stim control unit available today. If you want More Power, More Control, and more fun, then the 2B is the one you want.
Post Reply
User avatar
LondonSubNigel
Active Developer
Posts: 324
Joined: Wed Jul 06, 2011 5:13 pm
Location: London
Contact:

Text control

Post by LondonSubNigel »

I've been experimenting with ways to drive the 2B - though this will work with any box that has an audio input.

I have an old spare Nokia Symbian phone, for which I've bought a cheap PAYG SIM card. I've installed a scripting system called M-Shell from www.m-shell.net on it.

On the memory card, I've created a folder called eStim, into which I've put three of the tracks from the audio CD, of varying lengths.
The phone's set not to have any message alerts or keypad tones, to avoid unwanted audio from the headphone output, which is connected to the 2B, set in 'Stereo' mode.

The phone responds to texts with the word 'short', 'medium' or 'long'; it replies with the word it's found, plays the appropriate audio file, and then sends the message 'complete'

On the phone screen it will say 'waiting ...' then 'short trigger' then 'complete'

If a few texts arrive, it will work through them in order.

The script is below. I'll prob tweak it some more later.

Nigel.

Code: Select all

/*
 A very simple m SMS
 service to play audio files
*/
use sms
use audio

stim=["short" : "e:\\estim\\07.mp3",
           "medium" : "e:\\estim\\11.mp3",
           "long" : "e:\\estim\\06.mp3"];

while true do
 print "Waiting...";
 n=sms.receive();
 m=sms.get(n);
 t=lower(trim(m["text"]));
 if stim[t] #null then
   sms.send(m["sender"], t);
   audio.volume(100);
   audio.play(stim[t]);
   print  t, " trigger";
   while audio.busy() do
    sleep(500)
   end;
   print "complete";
   sms.send(m["sender"], "complete");
 end;
end


Post Reply