Index: /trunk/Arduino/GSM/Calibrate500/Calibrate500.ino
===================================================================
--- /trunk/Arduino/GSM/Calibrate500/Calibrate500.ino	(revision 17968)
+++ /trunk/Arduino/GSM/Calibrate500/Calibrate500.ino	(revision 17968)
@@ -0,0 +1,45 @@
+#include <Wire.h>
+#include <LSM303.h>
+
+LSM303 compass;
+LSM303::vector running_min = {2047, 2047, 2047}, running_max = {-2048, -2048, -2048};
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println("Starting ...");
+  Wire.begin();
+  Serial.println("Ini Wire");
+  compass.init();
+  Serial.println("Ini compass ...");
+  compass.enableDefault();
+}
+
+void loop() {  
+  compass.read();
+  
+  running_min.x = min(running_min.x, compass.m.x);
+  running_min.y = min(running_min.y, compass.m.y);
+  running_min.z = min(running_min.z, compass.m.z);
+
+  running_max.x = max(running_max.x, compass.m.x);
+  running_max.y = max(running_max.y, compass.m.y);
+  running_max.z = max(running_max.z, compass.m.z);
+  
+  Serial.print("M min ");
+  Serial.print("X: ");
+  Serial.print((int)running_min.x);
+  Serial.print(" Y: ");
+  Serial.print((int)running_min.y);
+  Serial.print(" Z: ");
+  Serial.print((int)running_min.z);
+
+  Serial.print(" M max ");  
+  Serial.print("X: ");
+  Serial.print((int)running_max.x);
+  Serial.print(" Y: ");
+  Serial.print((int)running_max.y);
+  Serial.print(" Z: ");
+  Serial.println((int)running_max.z);
+  
+  delay(100);
+}
Index: /trunk/Arduino/GSM/arduinoGSMFACT_beta_01/arduinoGSMFACT_beta_01.ino
===================================================================
--- /trunk/Arduino/GSM/arduinoGSMFACT_beta_01/arduinoGSMFACT_beta_01.ino	(revision 17968)
+++ /trunk/Arduino/GSM/arduinoGSMFACT_beta_01/arduinoGSMFACT_beta_01.ino	(revision 17968)
@@ -0,0 +1,259 @@
+/*
+
+  Arduino for FACT
+
+  Gareth Hughes 2013-10-30
+
+  Using: Arduino Ethernet
+	 GSM Overlay
+	 LSM303: Magnetic field and accelerometer 
+	 YL-38: Light Sensor
+
+  Function: Will reply to an SMS stating the position, movement and light level.
+	    If lighlevel gets above a certain threshold will send a warning SMS every 1 min.
+
+*/
+
+#include <SPI.h>
+#include <Ethernet.h>
+
+// include libraries
+#include <GSM.h>
+#include <Wire.h>
+#include <LSM303.h>
+
+//ETH
+//byte mac[]   = { 0x90, 0xA2, 0xDA, 0x0D, 0xB5, 0xE3 };
+//byte ip[]    = { 192, 33, 103, 241 };
+//LA PALMA
+byte mac[]   = { 0xFA, 0xC7, 0xBB, 0xFF, 0x33, 0x33 };
+byte ip[]    = { 10, 0, 100, 202 };
+
+EthernetServer server = EthernetServer(23);
+EthernetClient client;
+//boolean sentHeader = false;
+bool sentHeader = false;
+
+// PIN Number for the SIM
+//#define PINNUMBER "0839"
+#define PINNUMBER ""
+//#define PINNUMBER "7143"
+#define NUMLEN 15
+
+// initialize the library instances
+GSM gsmAccess;
+GSM_SMS sms;
+LSM303 compass;
+
+char  message[18];      // Array to hold SMS message
+char  senderNumber[NUMLEN];  // Array to hold the number a SMS is retreived from
+
+//unsigned int   counter    =  0;     // loop counter
+int   heading    = -9999;  // Continual heading reading
+//int   heading2   = -9999;  // Continual heading reading
+float pitch      = -9999.; // Pitch relative to horizon
+int   iLight     =  9999;  // light level
+int   iDiff      = -9999;  // difference in degrees
+char c;
+
+void setup() 
+{
+
+
+  //begin the ethernet connections
+  //Ethernet.begin(mac, ip, dnserver, gatew, smask);  // this is to begin (ethz) ethernet
+  Ethernet.begin(mac, ip);
+  server.begin();
+
+  // initialize serial communications and wait for port to open:
+  //Serial.begin(9600);
+
+  // Start the Wire communication
+  Wire.begin();
+
+  // Initialize the Compass
+  compass.init();
+  compass.enableDefault();
+
+  // Calibration values. Use the Calibrate example program to get the values for your compass.
+// ETH Calibration values
+//  compass.m_min.x = -700; compass.m_min.y = -695; compass.m_min.z = -635;
+//  compass.m_max.x = +293; compass.m_max.y = +551; compass.m_max.z = 606;
+// La Palma calibration values
+  compass.m_min.x = -389; compass.m_min.y = -423; compass.m_min.z = -420;
+  compass.m_max.x = +510; compass.m_max.y = +420; compass.m_max.z = +315;
+    
+  // connection state
+  boolean notConnected = true;
+  
+  // Start GSM connection
+  while(notConnected)
+  {
+    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
+      notConnected = false;
+    else
+    {
+      delay(1000);
+    }
+  }
+
+  // use pin 9 to mean parked!
+  //pinMode(9, OUTPUT); 
+ 
+}
+
+void loop() 
+{
+
+  // If there are any SMSs available()  
+  if (sms.available())
+  {
+
+    // Get remote number
+    sms.remoteNumber(senderNumber, NUMLEN);
+
+    //if( sms.peek()=='#' )
+    //{
+       //sms.flush();
+    //} else if( sms.peek()=='P' || sms.peek()=='p' ) 
+    //} else 
+    if( sms.peek()=='P' )
+    {
+
+//Serial.println("I P");
+
+     // Generate message
+      generateMessage();
+      // reply to the message
+      sendSMS();
+
+    }
+ 
+    // flush sms memory
+    sms.flush();
+
+   }
+
+  // listen for incoming clients, and process qequest.
+  checkForClient();
+
+  // Main loop 
+  delay(1000);
+
+
+}
+
+// Send the message.
+// iType = 0: Sends reply to an SMS with the heading, movement and light level 
+// iType = 1: Sends an alert to predefined number warning that the light has gone above threshold
+void sendSMS()
+{
+
+  sms.beginSMS(senderNumber);
+  sms.print(message);
+  sms.endSMS(); 
+
+}
+
+void checkForClient()
+{
+
+  EthernetClient client = server.available();
+
+  if( client ) 
+  {
+
+    // an http request ends with a blank line
+    boolean currentLineIsBlank = true;
+
+    while( client.connected() ) 
+    {
+      if( client.available() ) 
+      {
+
+        if(!sentHeader)
+	{
+          printHelp();
+          sentHeader = true;
+        }
+
+        c = client.read();
+
+        switch( c ) 
+        {
+
+          case 'q':
+            sentHeader = false;
+            delay(1); // give the web browser time to receive the data
+            client.stop(); // close the connection:
+            break;
+          case 'h':
+            printHelp();
+            break;
+         case 'd':
+	    generateMessage();
+       	    server.println(message);
+            break;
+//         case 'p':
+//	    digitalWrite(9, HIGH);
+//            server.println("Park");
+//            break;
+        }
+
+      }
+    }
+
+  } 
+
+}
+
+// errr Print the Help Stuff
+void printHelp()
+{
+
+  server.println();
+  //server.println("FACT GSM");
+  //server.println("h help");
+  server.println("q quit");
+  server.println();
+  server.println("d direction");
+//  server.println("p Park Tel");
+  server.println();
+
+}
+
+// Get the pointing difference
+void getDiff()
+{
+
+  compass.read();
+  heading = compass.heading((LSM303::vector){0,-1,0}) - 90 - 24;
+  if( heading < 0 ) heading = heading + 360;
+  //server.println(heading);
+
+//  delay(5000);
+//  compass.read();
+//  heading2 = compass.heading((LSM303::vector){0,-1,0}) - 90;
+//  if( heading2 < 0 ) heading2 = heading2 + 360;
+//  iDiff = heading - heading2;
+//  //server.println(iDiff);
+    
+  pitch = atan(compass.a.x/sqrt(pow(compass.a.y,2.)+pow(compass.a.z,2.)));
+  pitch *= (180.0)/3.1415;
+  pitch += 13.;
+  pitch  = 90. - pitch;
+  
+}
+
+// Generate SMS
+void generateMessage()
+{
+
+  // Get pointing difference
+  getDiff();
+  // Read light level
+  iLight = analogRead(0);
+  // Setup message
+  sprintf(message,"%d %d %d\n",heading,(int)pitch,iLight);
+
+}
Index: /trunk/Arduino/GSM/arduinoGSMFACT_beta_02_nogms/arduinoGSMFACT_beta_02_nogms.ino
===================================================================
--- /trunk/Arduino/GSM/arduinoGSMFACT_beta_02_nogms/arduinoGSMFACT_beta_02_nogms.ino	(revision 17968)
+++ /trunk/Arduino/GSM/arduinoGSMFACT_beta_02_nogms/arduinoGSMFACT_beta_02_nogms.ino	(revision 17968)
@@ -0,0 +1,266 @@
+/*
+
+  Arduino for FACT
+
+  Gareth Hughes 2013-10-30
+
+  Using: Arduino Ethernet
+	 GSM Overlay
+	 LSM303: Magnetic field and accelerometer 
+	 YL-38: Light Sensor
+
+  Function: Will reply to an SMS stating the position, movement and light level.
+	    If lighlevel gets above a certain threshold will send a warning SMS every 1 min.
+
+*/
+
+#include <SPI.h>
+#include <Ethernet.h>
+
+// include libraries
+//GH// #include <GSM.h>
+#include <Wire.h>
+#include <LSM303.h>
+
+//ETH
+//byte mac[]   = { 0x90, 0xA2, 0xDA, 0x0D, 0xB5, 0xE3 };
+//byte ip[]    = { 192, 33, 103, 241 };
+//LA PALMA
+byte mac[]   = { 0xFA, 0xC7, 0xBB, 0xFF, 0x33, 0x33 };
+byte ip[]    = { 10, 0, 100, 202 };
+
+EthernetServer server = EthernetServer(23);
+EthernetClient client;
+//boolean sentHeader = false;
+bool sentHeader = false;
+
+// PIN Number for the SIM
+//#define PINNUMBER "0839"
+#define PINNUMBER ""
+//#define PINNUMBER "7143"
+#define NUMLEN 15
+
+// initialize the library instances
+//GH// GSM gsmAccess;
+//GH// GSM_SMS sms;
+LSM303 compass;
+
+char  message[18];      // Array to hold SMS message
+//GH// char  senderNumber[NUMLEN];  // Array to hold the number a SMS is retreived from
+
+//unsigned int   counter    =  0;     // loop counter
+int   heading    = -9999;  // Continual heading reading
+//int   heading2   = -9999;  // Continual heading reading
+float pitch      = -9999.; // Pitch relative to horizon
+int   iLight     =  9999;  // light level
+int   iDiff      = -9999;  // difference in degrees
+char c;
+
+void setup() 
+{
+
+
+  //begin the ethernet connections
+  //Ethernet.begin(mac, ip, dnserver, gatew, smask);  // this is to begin (ethz) ethernet
+  Ethernet.begin(mac, ip);
+  server.begin();
+
+  // initialize serial communications and wait for port to open:
+  //Serial.begin(9600);
+
+  // Start the Wire communication
+  Wire.begin();
+
+  // Initialize the Compass
+  compass.init();
+  compass.enableDefault();
+
+  // Calibration values. Use the Calibrate example program to get the values for your compass.
+// ETH Calibration values
+//  compass.m_min.x = -700; compass.m_min.y = -695; compass.m_min.z = -635;
+//  compass.m_max.x = +293; compass.m_max.y = +551; compass.m_max.z = 606;
+// La Palma calibration values
+  compass.m_min.x = -389; compass.m_min.y = -423; compass.m_min.z = -420;
+  compass.m_max.x = +510; compass.m_max.y = +420; compass.m_max.z = +315;
+    
+/* //GH//     
+  // connection state
+  boolean notConnected = true;
+  
+  // Start GSM connection
+  while(notConnected)
+  {
+    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
+      notConnected = false;
+    else
+    {
+      delay(1000);
+    }
+  }
+*/
+
+  // use pin 9 to mean parked!
+  //pinMode(9, OUTPUT); 
+ 
+}
+
+void loop() 
+{
+
+/* //GH//
+  // If there are any SMSs available()  
+  if (sms.available())
+  {
+
+    // Get remote number
+    sms.remoteNumber(senderNumber, NUMLEN);
+
+    //if( sms.peek()=='#' )
+    //{
+       //sms.flush();
+    //} else if( sms.peek()=='P' || sms.peek()=='p' ) 
+    //} else 
+    if( sms.peek()=='P' )
+    {
+
+//Serial.println("I P");
+
+     // Generate message
+      generateMessage();
+      // reply to the message
+      sendSMS();
+
+    }
+ 
+    // flush sms memory
+    sms.flush();
+
+   }
+*/
+
+  // listen for incoming clients, and process qequest.
+  checkForClient();
+
+  // Main loop 
+  delay(1000);
+
+
+}
+
+/* //GH//
+// Send the message.
+// iType = 0: Sends reply to an SMS with the heading, movement and light level 
+// iType = 1: Sends an alert to predefined number warning that the light has gone above threshold
+void sendSMS()
+{
+
+  sms.beginSMS(senderNumber);
+  sms.print(message);
+  sms.endSMS(); 
+
+}
+*/
+
+void checkForClient()
+{
+
+  EthernetClient client = server.available();
+
+  if( client ) 
+  {
+
+    // an http request ends with a blank line
+    boolean currentLineIsBlank = true;
+
+    while( client.connected() ) 
+    {
+      if( client.available() ) 
+      {
+
+        if(!sentHeader)
+	{
+          printHelp();
+          sentHeader = true;
+        }
+
+        c = client.read();
+
+        switch( c ) 
+        {
+
+          case 'q':
+            sentHeader = false;
+            delay(1); // give the web browser time to receive the data
+            client.stop(); // close the connection:
+            break;
+          case 'h':
+            printHelp();
+            break;
+         case 'd':
+	    generateMessage();
+       	    server.println(message);
+            break;
+//         case 'p':
+//	    digitalWrite(9, HIGH);
+//            server.println("Park");
+//            break;
+        }
+
+      }
+    }
+
+  } 
+
+}
+
+// errr Print the Help Stuff
+void printHelp()
+{
+
+  server.println();
+  //server.println("FACT GSM");
+  //server.println("h help");
+  server.println("q quit");
+  server.println();
+  server.println("d direction");
+//  server.println("p Park Tel");
+  server.println();
+
+}
+
+// Get the pointing difference
+void getDiff()
+{
+
+  compass.read();
+  heading = compass.heading((LSM303::vector){0,-1,0}) - 90 - 24;
+  if( heading < 0 ) heading = heading + 360;
+  //server.println(heading);
+
+//  delay(5000);
+//  compass.read();
+//  heading2 = compass.heading((LSM303::vector){0,-1,0}) - 90;
+//  if( heading2 < 0 ) heading2 = heading2 + 360;
+//  iDiff = heading - heading2;
+//  //server.println(iDiff);
+    
+  pitch = atan(compass.a.x/sqrt(pow(compass.a.y,2.)+pow(compass.a.z,2.)));
+  pitch *= (180.0)/3.1415;  
+  pitch += 13.;
+  pitch  = 90. - pitch;
+
+
+}
+
+// Generate SMS
+void generateMessage()
+{
+
+  // Get pointing difference
+  getDiff();
+  // Read light level
+  iLight = analogRead(0);
+  // Setup message
+  sprintf(message,"%d %d %d\n",heading,(int)pitch,iLight);
+
+}
Index: /trunk/Arduino/GSM/connectAndSendSMS/connectAndSendSMS.ino
===================================================================
--- /trunk/Arduino/GSM/connectAndSendSMS/connectAndSendSMS.ino	(revision 17968)
+++ /trunk/Arduino/GSM/connectAndSendSMS/connectAndSendSMS.ino	(revision 17968)
@@ -0,0 +1,209 @@
+#include <Wire.h>
+#include <LSM303.h>
+#include <GSM.h>
+
+LSM303 compass;
+GSM_SMS sms;
+
+// PIN Number
+#define PINNUMBER ""
+
+// char array of the message
+  //char txtMsg[200]= "Hello";
+
+// char array of the telephone number to send SMS
+// change the number 1-212-555-1212 to a number
+// you have access to
+///char destinationNumber[20]= "+4917687545809";  
+
+// initialize the library instance
+GSM gsmAccess(true);     // include a 'true' parameter for debug enabled
+GSMScanner scannerNetworks;
+GSMModem modemTest;
+
+// Save data variables
+String IMEI = "";
+
+// serial monitor result messages
+String errortext = "ERROR";
+
+// Array to hold the number a SMS is retreived from
+char senderNumber[20];
+
+void setup()
+{
+
+  Serial.begin(9600);
+  Wire.begin();
+  compass.init();
+  compass.enableDefault();
+  
+  // Calibration values. Use the Calibrate example program to get the values for
+  // your compass.
+  compass.m_min.x = -700; compass.m_min.y = -695; compass.m_min.z = -635;
+  compass.m_max.x = +293; compass.m_max.y = +551; compass.m_max.z = 606;
+
+  // initialize serial communications
+  Serial.begin(9600);
+  Serial.println("GSM networks scanner");
+  scannerNetworks.begin();
+
+  // connection state
+  boolean notConnected = true;
+
+  // Start GSM shield
+  // If your SIM has PIN, pass it as a parameter of begin() in quotes
+  while(notConnected)
+  {
+    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
+      notConnected = false;
+    else
+    {
+      Serial.println("Not connected");
+      delay(1000);
+    }
+  }
+
+  // get modem parameters
+  // IMEI, modem unique identifier
+  Serial.print("Modem IMEI: ");
+  IMEI = modemTest.getIMEI();
+  IMEI.replace("\n","");
+  if(IMEI != NULL)
+    Serial.println(IMEI);
+
+  // currently connected carrier
+  Serial.print("Current carrier: ");
+  Serial.println(scannerNetworks.getCurrentCarrier());
+
+  // returns strength and ber
+  // signal strength in 0-31 scale. 31 means power > 51dBm
+  // BER is the Bit Error Rate. 0-7 scale. 99=not detectable
+  Serial.print("Signal Strength: ");
+  Serial.print(scannerNetworks.getSignalStrength());
+  Serial.println(" [0-31]");
+}
+
+void loop()
+{
+
+  char c;
+
+  // scan for existing networks, displays a list of networks
+  Serial.println("Scanning available networks. May take some seconds.");
+  Serial.println(scannerNetworks.readNetworks());
+
+  // currently connected carrier
+  Serial.print("Current carrier: ");
+  Serial.println(scannerNetworks.getCurrentCarrier());
+
+  // returns strength and ber
+  // signal strength in 0-31 scale. 31 means power > 51dBm
+  // BER is the Bit Error Rate. 0-7 scale. 99=not detectable
+  Serial.print("Signal Strength: ");
+  Serial.print(scannerNetworks.getSignalStrength());
+  Serial.println(" [0-31]");
+
+  Serial.print("Outside the LOOP ");
+  Serial.println(scannerNetworks.getCurrentCarrier());
+
+  if( scannerNetworks.getCurrentCarrier() == "Orange" )
+  {
+
+////  
+  // If there are any SMSs available()  
+  if (sms.available())
+  {
+   Serial.println("Message received from:");
+    
+    // Get remote number
+    sms.remoteNumber(senderNumber, 20);
+    Serial.println(senderNumber);
+
+    // An example of message disposal    
+    // Any messages starting with # should be discarded
+    if(sms.peek()=='#')
+    {
+      Serial.println("Discarded SMS");
+      sms.flush();
+    }
+    
+    // Read message bytes and print them
+    while(c=sms.read())
+      Serial.print(c);
+      
+    Serial.println("\nEND OF MESSAGE");
+    
+    // Delete message from modem memory
+    sms.flush();
+    Serial.println("MESSAGE DELETED");
+
+    compass.read();
+    int heading = compass.heading((LSM303::vector){0,-1,0});
+    Serial.print("Pointing: ");
+    Serial.println(heading);
+    Serial.println("SENDING!!!");
+    ///sendSMS();
+////SMS////
+  //Serial.print("Message to mobile number: ");
+  //Serial.println(senderNumber);
+  //char txtMsg[200];
+  //sprintf(txtMsg,"%d",heading);
+  //// sms text
+  //Serial.println("SENDING");
+  //Serial.println();
+  //Serial.println("Message:");
+  //Serial.println(txtMsg);
+  //// send the message
+  //sms.beginSMS(senderNumber);
+  //sms.print(txtMsg);
+  //sms.endSMS(); 
+  //Serial.println("\nCOMPLETE!\n");  
+////!SMS////
+    for( ;; )
+      ;
+
+
+   } else 
+   {
+    if(!gsmAccess.begin(PINNUMBER)==GSM_READY)
+      Serial.println("Not Connected!");
+    Serial.println("Scanning available networks. May take some seconds.");
+    Serial.println(scannerNetworks.readNetworks());
+    Serial.print("Waiting ... ");
+    Serial.print("Current carrier: ");
+    Serial.print(scannerNetworks.getCurrentCarrier());
+    Serial.print(" Signal Strength: ");
+    Serial.print(scannerNetworks.getSignalStrength());
+    Serial.println(" [0-31]");
+    delay(1000);
+
+  }
+
+  } else 
+  {
+    Serial.println("Else Loop....");
+  }
+
+
+}
+/*
+void sendSMS()
+{
+
+  Serial.print("Message to mobile number: ");
+  Serial.println(destinationNumber);
+
+  // sms text
+  Serial.println("SENDING");
+  Serial.println();
+  Serial.println("Message:");
+  Serial.println(txtMsg);
+
+  // send the message
+  sms.beginSMS(destinationNumber);
+  sms.print(txtMsg);
+  sms.endSMS(); 
+  Serial.println("\nCOMPLETE!\n");  
+}
+*/
Index: /trunk/Arduino/GSM/ethernetNetExample/ethernetNetExample.ino
===================================================================
--- /trunk/Arduino/GSM/ethernetNetExample/ethernetNetExample.ino	(revision 17968)
+++ /trunk/Arduino/GSM/ethernetNetExample/ethernetNetExample.ino	(revision 17968)
@@ -0,0 +1,142 @@
+
+#include <Ethernet.h>
+#include <SPI.h>
+boolean reading = false;
+
+////////////////////////////////////////////////////////////////////////
+//CONFIGURE
+////////////////////////////////////////////////////////////////////////
+  //byte ip[] = { 192, 168, 0, 199 };   //Manual setup only
+  //byte gateway[] = { 192, 168, 0, 1 }; //Manual setup only
+  //byte subnet[] = { 255, 255, 255, 0 }; //Manual setup only
+
+  // if need to change the MAC address (Very Rare)
+  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
+
+  EthernetServer server = EthernetServer(80); //port 80
+////////////////////////////////////////////////////////////////////////
+
+void setup(){
+  Serial.begin(9600);
+
+  //Pins 10,11,12 & 13 are used by the ethernet shield
+
+  pinMode(2, OUTPUT);
+  pinMode(3, OUTPUT);
+  pinMode(4, OUTPUT);
+  pinMode(5, OUTPUT);
+  pinMode(6, OUTPUT);
+  pinMode(7, OUTPUT);
+  pinMode(8, OUTPUT);
+  pinMode(9, OUTPUT);
+
+  Ethernet.begin(mac);
+  //Ethernet.begin(mac, ip, gateway, subnet); //for manual setup
+
+  server.begin();
+  Serial.println(Ethernet.localIP());
+
+}
+
+void loop(){
+
+  // listen for incoming clients, and process qequest.
+  checkForClient();
+
+}
+
+void checkForClient(){
+
+  EthernetClient client = server.available();
+
+  if (client) {
+
+    // an http request ends with a blank line
+    boolean currentLineIsBlank = true;
+    boolean sentHeader = false;
+
+    while (client.connected()) {
+      if (client.available()) {
+
+        if(!sentHeader){
+          // send a standard http response header
+          client.println("HTTP/1.1 200 OK");
+          client.println("Content-Type: text/html");
+          client.println();
+          sentHeader = true;
+        }
+
+        char c = client.read();
+
+        if(reading && c == ' ') reading = false;
+        if(c == '?') reading = true; //found the ?, begin reading the info
+
+        if(reading){
+          Serial.print(c);
+
+           switch (c) {
+            case '2':
+              //add code here to trigger on 2
+              triggerPin(2, client);
+              break;
+            case '3':
+            //add code here to trigger on 3
+              triggerPin(3, client);
+              break;
+            case '4':
+            //add code here to trigger on 4
+              triggerPin(4, client);
+              break;
+            case '5':
+            //add code here to trigger on 5
+              triggerPin(5, client);
+              break;
+            case '6':
+            //add code here to trigger on 6
+              triggerPin(6, client);
+              break;
+            case '7':
+            //add code here to trigger on 7
+              triggerPin(7, client);
+              break;
+            case '8':
+            //add code here to trigger on 8
+              triggerPin(8, client);
+              break;
+            case '9':
+            //add code here to trigger on 9
+              triggerPin(9, client);
+              break;
+          }
+
+        }
+
+        if (c == '\n' && currentLineIsBlank)  break;
+
+        if (c == '\n') {
+          currentLineIsBlank = true;
+        }else if (c != '\r') {
+          currentLineIsBlank = false;
+        }
+
+      }
+    }
+
+    delay(1); // give the web browser time to receive the data
+    client.stop(); // close the connection:
+
+  } 
+
+}
+
+void triggerPin(int pin, EthernetClient client){
+//blink a pin - Client needed just for HTML output purposes.  
+  client.print("Turning on pin ");
+  client.println(pin);
+  client.print("<br>");
+
+  digitalWrite(pin, HIGH);
+  delay(25);
+  digitalWrite(pin, LOW);
+  delay(25);
+}
Index: /trunk/Arduino/GSM/readLightSensor/readLightSensor.ino
===================================================================
--- /trunk/Arduino/GSM/readLightSensor/readLightSensor.ino	(revision 17968)
+++ /trunk/Arduino/GSM/readLightSensor/readLightSensor.ino	(revision 17968)
@@ -0,0 +1,41 @@
+#define ANA_PIN 0
+#define DIGI_PIN 1
+
+//int val;
+  
+void  setup()
+{
+
+  Serial.begin(9800);
+  pinMode(DIGI_PIN,INPUT);
+
+  
+}
+
+void loop()
+{
+
+  Serial.print(analogRead(ANA_PIN));
+  Serial.print(" ");
+  Serial.println(digitalRead(DIGI_PIN));
+  
+/*
+  
+  val = digitalRead(DIGI_PIN);
+  
+  Serial.println(val);
+  
+
+  if(digitalRead(DIGI_PIN))
+  {
+    Serial.print(digitalRead(DIGI_PIN));
+    Serial.println(" HI");
+  } else 
+  {
+    Serial.println(digitalRead(DIGI_PIN));
+  }
+*/
+
+  //delay(1000);
+
+}
Index: /trunk/Arduino/GSM/testConnect/testConnect.ino
===================================================================
--- /trunk/Arduino/GSM/testConnect/testConnect.ino	(revision 17968)
+++ /trunk/Arduino/GSM/testConnect/testConnect.ino	(revision 17968)
@@ -0,0 +1,84 @@
+// import the GSM library
+#include <GSM.h>
+
+// PIN Number
+//#define PINNUMBER "0839"
+//#define PINNUMBER "7143"
+#define PINNUMBER "0060"
+
+// initialize the library instance
+GSM gsmAccess(true);     // include a 'true' parameter for debug enabled
+//GSM gsmAccess(false);     // include a 'true' parameter for debug enabled
+GSMScanner scannerNetworks;
+GSMModem modemTest;
+
+// Save data variables
+String IMEI = "";
+
+// serial monitor result messages
+String errortext = "ERROR";
+
+void setup()
+{
+  // initialize serial communications
+  Serial.begin(9600);
+  Serial.println("GSM networks scanner");
+  scannerNetworks.begin();
+
+  // connection state
+  boolean notConnected = true;
+
+  // Start GSM shield
+  // If your SIM has PIN, pass it as a parameter of begin() in quotes
+  while(notConnected)
+  {
+    if(gsmAccess.begin(PINNUMBER,true,true)==GSM_READY)
+      notConnected = false;
+    else
+    {
+      Serial.println("Not connected");
+      delay(1000);
+    }
+  }
+
+  // get modem parameters
+  // IMEI, modem unique identifier
+  Serial.print("Modem IMEI: ");
+  IMEI = modemTest.getIMEI();
+  IMEI.replace("\n","");
+  if(IMEI != NULL)
+    Serial.println(IMEI);
+
+  // currently connected carrier
+  Serial.print("Current carrier: ");
+  Serial.println(scannerNetworks.getCurrentCarrier());
+
+  // returns strength and ber
+  // signal strength in 0-31 scale. 31 means power > 51dBm
+  // BER is the Bit Error Rate. 0-7 scale. 99=not detectable
+  Serial.print("Signal Strength: ");
+  Serial.print(scannerNetworks.getSignalStrength());
+  Serial.println(" [0-31]");
+}
+
+void loop()
+{
+  // scan for existing networks, displays a list of networks
+  Serial.println("Scanning available networks. May take some seconds.");
+
+  Serial.println(scannerNetworks.readNetworks());
+
+    // currently connected carrier
+  Serial.print("Current carrier: ");
+  Serial.println(scannerNetworks.getCurrentCarrier());
+
+  // returns strength and ber
+  // signal strength in 0-31 scale. 31 means power > 51dBm
+  // BER is the Bit Error Rate. 0-7 scale. 99=not detectable
+  Serial.print("Signal Strength: ");
+  Serial.print(scannerNetworks.getSignalStrength());
+  Serial.println(" [0-31]");
+
+}
+ 
+
