Hi,
I would like to use the code to send sms from any phone to my code and randomly display the text on the screen. But I don’t know how to set the code (now it says Huawei, should I change line 20 to match a particular phone?) and to what number I must send the sms. Also if you had an idea of how to modify the script so the sms display randomly across the screen + If it is possible to allow collisions between text and other geometries, would be great!
thank you in advance,
/**
* Exampple on receiving incoming short messages with
* smsP5 library.
*
* @author Hamzeen. H.
* @created 03/24/2013
*/
import com.hamzeen.sms.*;
import org.smslib.InboundMessage;
ReceiveSms receiver;
ArrayList<String> incomingMsgList;
ArrayList<InboundMessage> inboundMsgs;
PFont font;
void setup(){
size(400,400);
org.apache.log4j.BasicConfigurator.configure();
receiver = new ReceiveSms("modem.com1", "COM3", 19200,"Huawei", "E220",3);
font = createFont( "Arial", 16 );
textFont(font);
textAlign(LEFT);
noStroke();
}
void draw() {
background(0);
incomingMsgList = new ArrayList<String>(receiver.getIncomingMsgList());
inboundMsgs = new ArrayList<InboundMessage>(receiver.getInboundMsgList());
if(frameCount%32>7){
fill(255,255,255);
rect(width-30, 7,25,25);
}else{
fill(0,0,0);
rect(width-30, 7,25,25);
}
fill(200);
text("Messages:"+incomingMsgList.size(), width-140, 28);
if(incomingMsgList.size() > 0) {
for(int i =0;i<incomingMsgList.size();i++){
String str = incomingMsgList.get(incomingMsgList.size()-1-i).toString();
text(str, 20, 60+(i*30));
}
}
}