Arduino project, serial not reading, please help!

For my project, I have an ultrasonic sensor hooked up to a Arduino mkr 1000 and once triggered it connects with temboo and Twilio to send a sms message to your phone. The code uploads fine but it dosent read any of the data the sensor is outputting. I ran a basic test in another sketch to see if my sensor was working and it reads fine, but once I add the temboo stuff it doesn't work. I took out my phone number but in my actual code it is in there. I also have a header tab with my temboo account info set up in my code. Any help would be appreciated, or if there is an easier way to do this (like use processing) let me know. Thanks.

#include <SPI.h>
#include <Bridge.h>
#include <WiFi101.h>
#include <WiFiSSLClient.h>
#include <TembooSSL.h>
#include "TembooAccount.h" // contains Temboo account information

WiFiSSLClient client;
int numRuns = 1; // Execution count, so this doesn't run forever
int maxRuns = 5; // Maximum number of times the Choreo should be executed
int trigPin = 6;
int echoPin = 7;
long duration, cm, inches;

void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
// For debugging, wait until the serial console is connected
Serial.println("Patrol Mode Initiated...");

void loop() {

digitalWrite(trigPin, LOW);
digitalWrite(trigPin, HIGH);
digitalWrite(trigPin, LOW);

pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);

inches = (duration / 2) / 74;
if (inches < 20 || inches > 500) {
Serial.println("Bad Guy Detected!");
Serial.println("Sending text Notification...");

if (numRuns <= maxRuns) {
Serial.println("Running SendSMS - Run #" + String(numRuns++));

TembooChoreoSSL SendSMSChoreo(client);

// Invoke the Temboo client

// Set Temboo account credentials

// Set Choreo inputs
SendSMSChoreo.addInput("AuthToken", "572f2163a5fc6c9342dd859f5b3edfb6"); // AUTH TOKEN
SendSMSChoreo.addInput("To", "my number"); // cell number that your want the text to go to
SendSMSChoreo.addInput("From", "+14844699383"); // Twilio phone number
SendSMSChoreo.addInput("Body", "Theres a Criminal In yo crib!!!!!!"); // Message
SendSMSChoreo.addInput("AccountSID", "AC64b95face1eae1e7b5bae2813b68555d"); // Account SID

// Identify the Choreo to run

// Run the Choreo; when results are available, print them to serial;

while(SendSMSChoreo.available()) {
char c =;

delay(10000); // wait 10 seconds between SendSMS calls

Serial.println("Patrol Mode Initiated...");

}//end if statement

}//ends loop

Arduino project, serial not reading, please help!

You are not reading serial data. You are print()ing a tiny amount of absolutely useless data. You have a boatload of code for a non-working project.

Dump 98% of that code. JUST read from the sensor, and write to the port. When that works, start adding code back.

Do your self a HUGE favor. Put EVERY { on line BY ITSELF. Put EVERY } on a line BY ITSELF. Use Tools + Auto Format.

You will not make the same mistake again that you made this time.

Look at your code. Determine EXACTLY what needs to be true in order to send a message.

    Serial.println("Running SendSMS - Run #" + String(numRuns++));

Hiding the increment of numRuns in a call the String constructor is a VERY poor idea. Using the String class that way is waste of resources. Use multiple Serial.print() statements instead of pissing away resources on the String class.

Can I just say that I don't want your project to send an SMS to my phone.

Please remember to use code tags when posting code.