I'm attempting a few things but I'm kinda all over place but let me explain what my goal is. I'm trying to send a message over an E-mail and it seems I reach my limit through using char MessageBodyValue[127]; Which limits me to about a solid sentence. Is there a way to use a bigger data type to store more information so I can contain more data in my E-mail? I tried concatinating but my conclusion was you can't put two char MessageBodyValue1[127]; together into another Char that is the same size. I could really use some help.
Thank you!
/* Setup shield-specific #include statements */
#include <Time.h>
#include <Wire.h>
#include <DS1307RTC.h>
#include <SPI.h>
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <Temboo.h>
#include "TembooAccount.h" // Contains Temboo account information
byte ethernetMACAddress[] = ETHERNET_SHIELD_MAC;
EthernetClient client;
int calls = 0;
int inputPin = 8;
int sensorValue;
int LightSensor;
int TempSensor;
float TempCel;
float voltage;
float HumiditySensor;
double RelativeHumidity;
String TimeTest;
// The number of times to trigger the action if the condition is met.
// We limit this so you won't use all of your Temboo calls while testing.
int maxCalls = 3;
// The number of times this Choreo has been run so far in this sketch.
void setup() {
Serial.begin(9600);
setSyncProvider(RTC.get);
// For debugging, wait until the serial console is connected.
delay(4000);
while (!Serial);
Serial.print("DHCP:");
if (Ethernet.begin(ethernetMACAddress) == 0) {
Serial.println("FAIL");
while (true);
}
Serial.println("OK");
delay(5000);
// Initialize pins
pinMode(inputPin, INPUT_PULLUP);
//Serial.println("Setup complete.\n");
}
void loop() {
sensorValue = digitalRead(inputPin);
LightSensor = analogRead(A0);
TempSensor = analogRead(A1);
voltage = TempSensor * 5.0;
voltage /= 1024.0;
TempCel = (voltage - 0.5) * 100;
HumiditySensor = analogRead(A2);
RelativeHumidity = HumiditySensor;
//Serial.println((RelativeHumidity)/(1.0546 - 0.00216)/10 - 8) ;
Serial.println(TempCel);
if (sensorValue == LOW || LightSensor >= 200) {
if (calls < maxCalls) {
Serial.println("\nTriggered! Calling /Library/Google/Gmail/SendEmail...");
runSendEmail();
calls++;
} else {
// Serial.println("\nTriggered! Skipping the action to save Temboo calls during testing.");
// Serial.println("You can adjust or remove the calls/maxCalls if() statement to change this behavior.\n");
}
} else if ( TempCel >= 29) {
if (calls < maxCalls) {
Serial.println("\nTriggered! Calling /Library/Google/Gmail/SendEmail...");
runSendEmail2();
calls++;
}
}
delay(250);
}
void runSendEmail() {
TembooChoreo SendEmailChoreo(client);
// Set Temboo account credentials
SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT);
SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
SendEmailChoreo.setAppKey(TEMBOO_APP_KEY);
// Set profile to use for execution
SendEmailChoreo.setProfile("GmailTesting");
// Set Choreo inputs
char MessageBodyValue[127];
char MessageBodyValue1[127];
sprintf(MessageBodyValue, "the current time is: %02d:%02d:%02d. \n Hey we are testing length of the message possibilities. Problably maxed out by 127 bits. \n haven't Trying", hour(), minute(), second());
String MessageBodyTotal;
MessageBodyTotal = String(MessageBodyValue) + String(MessageBodyValue1) + String(MessageBodyValue)+ String(MessageBodyValue)+ String(MessageBodyValue)+ String(MessageBodyValue);
SendEmailChoreo.addInput("MessageBody", MessageBodyTotal);
// Identify the Choreo to run
SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail");
// Run the Choreo
unsigned int returnCode = SendEmailChoreo.run();
// A return code of zero means everything worked
if (returnCode == 0) {
digitalWrite(inputPin, HIGH);
}
SendEmailChoreo.close();
}
void runSendEmail2() {
TembooChoreo SendEmailChoreo(client);
// Set Temboo account credentials
SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT);
SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
SendEmailChoreo.setAppKey(TEMBOO_APP_KEY);
// Set profile to use for execution
SendEmailChoreo.setProfile("GmailTesting");
// Set Choreo inputs
char MessageBodyValue[127];
sprintf(MessageBodyValue, "the current time is: %02d:%02d:%02d, Your Humidity is: %e %% RH" , hour(), minute(), second(), RelativeHumidity /*,RelativeHumidity*/);
SendEmailChoreo.addInput("MessageBody", MessageBodyValue);
// Identify the Choreo to run
SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail");
// Run the Choreo
unsigned int returnCode = SendEmailChoreo.run();
// A return code of zero means everything worked
if (returnCode == 0) {
digitalWrite(inputPin, HIGH);
}
SendEmailChoreo.close();
}
I added myself transfer's to Strings and tested sending it multiple times and I do seem to be able to add much more text but i presume Im limited to a Char size of 127 until i concatenate it. Because the first sentence i have in my sprintf is the limite without making my email send would stop.
sprintf(MessageBodyValue, "the current time is: %02d:%02d:%02d, Your Humidity is: %e %% RH" , hour(), minute(), second(), RelativeHumidity /*,RelativeHumidity*/);