This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
#ifndef __CC3200R1M1RGC__ #include <SPI.h> #endif #include <WiFi.h> #include "PubNub.h" #include <aJSON.h> #include <Wire.h> #include <WiFiClient.h> #include <Temboo.h> #include "TembooAccount.h" #include <RF430CL.h> #include <NDEF.h> #include <NDEF_URI.h> #include <NDEF_TXT.h> #define APP_NAME "TFG-2017_MOHAMED RAHALI" #define RF430CL330H_BOOSTERPACK_RESET_PIN 8 #define RF430CL330H_BOOSTERPACK_IRQ_PIN 12 RF430 nfc(RF430CL330H_BOOSTERPACK_RESET_PIN, RF430CL330H_BOOSTERPACK_IRQ_PIN); //****************************************************************************************************************// // RFID/NFC FUNCTION // //****************************************************************************************************************// void RF430CL (void){ Serial.println("Initializing I2C-"); Wire.begin(); Serial.println("Initializing NFC Tag-"); nfc.begin(); Serial.println("Declaring URL object-"); NDEF_URI tiweb("https://freeboard.io/board/yMSkFJ"); Serial.println("Declaring text description for the URL-"); NDEF_TXT tidesc("es", "TFG_2017 REALIZADO POR MOHAMED RAHALI"); Serial.println("Writing URL object to NFC transceiver-"); int ndef_size; // RECORD 0 ndef_size = tiweb.sendTo(nfc, true, false); // This message should set MB, but not ME. Serial.println("Writing Text object to NFC transceiver-"); // RECORD 1 ndef_size += tidesc.sendTo(nfc, false, true); // This message should leave MB cleared, but set ME. Serial.println("Activating NFC transceiver-"); nfc.enable(); // // Serial.println("Printing URL to Serial port-"); // tiweb.printURI(Serial); // Test the NDEF_URI printURI() feature // Serial.println(); // // Serial.println("Printing text description to Serial port-"); // Serial.println(tidesc.getText()); } //------------------------------------- VARIABLES -------------------------------------// double randomDouble(double min, double max, int numCasas){ long _min = min * pow(10, numCasas) + 0.1; long _max = max * pow(10, numCasas) + 0.1; return (double) random(_min, _max) / pow(10, numCasas) ; } double Freq = randomDouble(10.71, 10.79, 2)+1839755.00; double voltage_1 = randomDouble(0.82, 0.88, 2); double temperature = randomDouble(18.30, 20.00, 2); double vol = randomDouble(3.10, 3.29, 2); unsigned long lastConnectionTime = 0; // Last time you connected to the server, in milliseconds boolean lastConnected = false; // State of the connection last time through the main loop const unsigned long postingInterval = 0.001*1000; // Delay between updates to ThingSpeak.com int failedCounter = 0; char buffer[25]; //buffer for float to string // Network Settings char ssid[] = "TP-LINK_4B41C0"; // Network name (SSID) char password[] = "L@F@mili@R@h@li/10"; // Network password int keyIndex = 0; // Network key Index number (needed only for WEP) WiFiServer server(80); WiFiClient client_1; WiFiClient *client; // WiFiClient client; //------------------------------------- floatToString Method -------------------------------------// String floatToString(float x, byte precision = 4) { char tmp[50]; dtostrf(x, 0, precision, tmp); return String(tmp); } //**************************************************************************************************************** // PubNub Credencial & send function //**************************************************************************************************************** const static char pubkey[] = "pub-c-f00e3441-95d8-4d27-a4fb-d03fb4def8ae"; const static char subkey[] = "sub-c-9d695234-13ad-11e7-894d-0619f8945a4f"; const static char channel[] = "Channel-mohamed"; int sn = 0; aJsonObject *createMessage() { aJsonObject *msg = aJson.createObject(); aJsonObject *sender = aJson.createObject(); double Freq = randomDouble(10.71, 10.79, 2)+1839755.00; double voltage_1 = randomDouble(0.82, 0.88, 2); double temperature = randomDouble(18.30, 20.00, 2); double vol = randomDouble(3.10, 3.29, 2); aJson.addStringToObject(sender, "name", "CC3100"); aJson.addItemToObject(msg, "sender", sender); aJson.addNumberToObject(msg, "sn", sn); aJson.addNumberToObject(msg, "FreqTiva", Freq); aJson.addNumberToObject(msg, "VolTiva", voltage_1); aJson.addNumberToObject(msg, "TempNodos", temperature); aJson.addNumberToObject(msg, "voltNodos", vol); sn++; if (sn == 9999) { sn = 0; } return msg; } void dumpMessage(Stream &s, aJsonObject *msg) { int msg_count = aJson.getArraySize(msg); for (int j = 0; j < msg_count; j++) { aJsonObject *item, *sender, *value; s.print("Msg #"); s.println(j, DEC); item = aJson.getArrayItem(msg, j); if (!item) { s.println("item not acquired"); delay(100); return; } /* Below, we parse and dump messages from fellow Arduinos. */ sender = aJson.getObjectItem(item, "sender"); if (!sender) { s.println("sender not acquired"); delay(100); return; } s.println(); } } //***************************************************************************** // WiFiConfig // Configure Wifi settings, connect to the net and create a web server //***************************************************************************** void WifiSettings(void){ Serial.print("Attempting to connect to Network named: "); // attempt to connect to Wifi network Serial.println(ssid); // print the network name (SSID) WiFi.begin(ssid, password); // Connect to WPA/WPA2 network. Change this line if using open or WEP network while ( WiFi.status() != WL_CONNECTED) { Serial.print("."); // Print dots while waiting for connection delay(300); } Serial.println("\nYou're connected to the network"); Serial.println("Waiting for an ip address"); while (WiFi.localIP() == INADDR_NONE) { Serial.print("."); // Print dots while we wait for an ip addresss delay(300); } Serial.println("\nIP Address obtained"); printWifiStatus(); } /* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ /* CALL-PHONE FUNCTION */ /* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ void callphone(void) { TembooChoreo ConfirmTextToSpeechPromptChoreo(client_1); // Set Temboo account credentials ConfirmTextToSpeechPromptChoreo.setAccountName(TEMBOO_ACCOUNT); ConfirmTextToSpeechPromptChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); ConfirmTextToSpeechPromptChoreo.setAppKey(TEMBOO_APP_KEY); // Set Choreo inputs String CallbackURLValue = "http://192.168.0.105/"; ConfirmTextToSpeechPromptChoreo.addInput("CallbackURL", CallbackURLValue); String APIKeyValue = "7ed8a7a3"; //String APIKeyValue = "9f187a57"; ConfirmTextToSpeechPromptChoreo.addInput("APIKey", APIKeyValue); String LanguageValue = "es-mx"; ConfirmTextToSpeechPromptChoreo.addInput("Language", LanguageValue); String ByeTextValue = "El valor actual de frecuencia_tiva es de "; ByeTextValue = ByeTextValue + (Freq/1000000) + " MHz. El voltaje_tiva detectado es de " + voltage_1; ByeTextValue = ByeTextValue + ", la temperatura_Nodo1 es" + temperature + ", el voltaje_Nodo1 es" + vol; ByeTextValue = ByeTextValue + ", la temperatura_Nodo2 es" + temperature + ", el voltaje_Nodo2 es" + vol + ". El informe de estado del equipo ha terminado. Hasta pronto."; ConfirmTextToSpeechPromptChoreo.addInput("ByeText", ByeTextValue); String TextValue = "CC3100 Remotes Updates. Niveles dentro de rango de seguridad."; TextValue = TextValue + ", . Pulse uno para conocer los valores actuales de los parámetros de medida."; ConfirmTextToSpeechPromptChoreo.addInput("Text", TextValue); String FromValue = "Mohamed Rahali"; ConfirmTextToSpeechPromptChoreo.addInput("From", FromValue); String ToValue = "34631113994"; //String ToValue = "34659962980"; ConfirmTextToSpeechPromptChoreo.addInput("To", ToValue); String FailedTextValue = "Por favor. Pulse uno para conocer valores medios de las últimas 24 horas"; ConfirmTextToSpeechPromptChoreo.addInput("FailedText", FailedTextValue); String MaxDigitsValue = "1"; ConfirmTextToSpeechPromptChoreo.addInput("MaxDigits", MaxDigitsValue); String PinCodeValue = "1"; ConfirmTextToSpeechPromptChoreo.addInput("PinCode", PinCodeValue); String APISecretValue = "aef89c1b5c48e7e1"; //String APISecretValue = "ba44ab82a0996581"; ConfirmTextToSpeechPromptChoreo.addInput("APISecret", APISecretValue); // Identify the Choreo to run ConfirmTextToSpeechPromptChoreo.setChoreo("/Library/Nexmo/Voice/ConfirmTextToSpeechPrompt"); // Run the Choreo unsigned int returnCode = ConfirmTextToSpeechPromptChoreo.run(); // A return code of zero means everything worked if (returnCode == 0) { while (ConfirmTextToSpeechPromptChoreo.available()) { String name = ConfirmTextToSpeechPromptChoreo.readStringUntil('\x1F'); name.trim(); ConfirmTextToSpeechPromptChoreo.find("\x1E"); } } ConfirmTextToSpeechPromptChoreo.close(); } /* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ /* SMS FUNCTION */ /* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ void SendSMSChoreo (void) { TembooChoreo SendSMSChoreo(client_1); // Invoke the Temboo client SendSMSChoreo.begin(); // Set Temboo account credentials SendSMSChoreo.setAccountName(TEMBOO_ACCOUNT); SendSMSChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); SendSMSChoreo.setAppKey(TEMBOO_APP_KEY); // Set profile to use for execution SendSMSChoreo.setProfile("SMStwilio"); // Set Choreo inputs String TimeoutValue = "1"; SendSMSChoreo.addInput("Timeout", TimeoutValue); String CallbackIDValue = "192.168.0.105"; SendSMSChoreo.addInput("CallbackID", CallbackIDValue); String BodyValue = "CC3100 REMOTE UPDATES. Niveles dentro de rango de seguridad. la frecuencia_Tiva detectada es de"; BodyValue = BodyValue + (Freq/1000000) + "MHz. El Voltaje_Tiva detectado es de" +voltage_1; BodyValue = BodyValue + "V, la temperatura_Nodo1 es" + temperature + "°C, el voltaje_Nodo1 es" + vol; BodyValue = BodyValue + "V, la temperatura_Nodo2 es" + temperature + "°C, el voltaje_Nodo2 es" + vol + "V. El informe de estado ha terminado. Hasta pronto."; SendSMSChoreo.addInput("Body", BodyValue); // Identify the Choreo to run SendSMSChoreo.setChoreo("/Library/Twilio/SMSMessages/SendSMS"); // Run the Choreo; when results are available, print them to serial // 901 time to wait for a Choreo response. Can be edited as needed // USE_SSL input to tell library to use HTTPS SendSMSChoreo.run(901, USE_SSL); while(SendSMSChoreo.available()) { char c = SendSMSChoreo.read(); Serial.print(c); } SendSMSChoreo.close(); } /* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ /* GMAIL FUNCTION */ /* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ void SendEmail (void){ TembooChoreo SendEmailChoreo(client_1); // Invoke the Temboo client SendEmailChoreo.begin(); // Set Temboo account credentials SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT); SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); SendEmailChoreo.setAppKey(TEMBOO_APP_KEY); // Set Choreo inputs String FromAddressValue = "cc3100updates@gmail.com"; SendEmailChoreo.addInput("FromAddress", FromAddressValue); String UsernameValue = "CC3100Updates"; SendEmailChoreo.addInput("Username", UsernameValue); String ToAddressValue = "medsimorahali@gmail.com"; SendEmailChoreo.addInput("ToAddress", ToAddressValue); String SubjectValue = "CC3100 TFG"; SendEmailChoreo.addInput("Subject", SubjectValue); String MessageBodyValue = "CC3100 REMOTE UPDATES. Niveles dentro de rango de seguridad. la frecuencia_Tiva detectada es de"; MessageBodyValue = MessageBodyValue + (Freq/1000000) + "MHz. El Voltaje_Tiva detectado es de" +voltage_1; MessageBodyValue = MessageBodyValue + "V, la temperatura_Nodo1 es" + temperature + "°C, el voltaje_Nodo1 es" + vol; MessageBodyValue = MessageBodyValue + "V, la temperatura_Nodo2 es" + temperature + "°C, el voltaje_Nodo2 es" + vol + "V. El informe de estado ha terminado. Hasta pronto."; SendEmailChoreo.addInput("MessageBody", MessageBodyValue); String PasswordValue = "jnezwawwhisucjqr"; SendEmailChoreo.addInput("Password", PasswordValue); // Identify the Choreo to run SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail"); // Run the Choreo; when results are available, print them to serial // 901 time to wait for a Choreo response. Can be edited as needed // USE_SSL input to tell library to use HTTPS SendEmailChoreo.run(); while(SendEmailChoreo.available()) { char c = SendEmailChoreo.read(); Serial.print(c); } SendEmailChoreo.close(); } /* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ /* Twitter FUNCTION */ /* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ void Sendtweets (void){ TembooChoreo StatusesUpdateChoreo(client_1); // Invoke the Temboo client StatusesUpdateChoreo.begin(); // Set Temboo account credentials StatusesUpdateChoreo.setAccountName(TEMBOO_ACCOUNT); StatusesUpdateChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); StatusesUpdateChoreo.setAppKey(TEMBOO_APP_KEY); // Set Choreo inputs String StatusUpdateValue ="CC3100 REMOTE UPDATES. F-Tiva= "; StatusUpdateValue = StatusUpdateValue + (Freq/1000000)+ " MHz. V-Tiva= " + voltage_1; StatusUpdateValue = StatusUpdateValue + "V, V_Nodo1= " +vol+ "V, t_Nodo1= " +temperature; StatusUpdateValue = StatusUpdateValue + "°C, V_Nodo2= " +vol+ "V, t_Nodo2= " +temperature+ "°C . Hasta pronto."; StatusesUpdateChoreo.addInput("StatusUpdate", StatusUpdateValue); String ConsumerKeyValue = "qCEqTnJi3LRIFDXc5RIPa79Ep"; StatusesUpdateChoreo.addInput("ConsumerKey", ConsumerKeyValue); String AccessTokenValue = "849004987527163904-OZK4Q1ffHQaYXNxVfjcTKuFsXQ6rUav"; StatusesUpdateChoreo.addInput("AccessToken", AccessTokenValue); String ConsumerSecretValue = "n4ALjkC2QW5yAHbhKviInza5FrHgGl6Mw8WiuClK0w0s2oYMgD"; StatusesUpdateChoreo.addInput("ConsumerSecret", ConsumerSecretValue); String AccessTokenSecretValue = "GSLjzTbY3EfHqrl58bCfbKxOKTNSrvQxotyMbI0XjWRzG"; StatusesUpdateChoreo.addInput("AccessTokenSecret", AccessTokenSecretValue); // Identify the Choreo to run StatusesUpdateChoreo.setChoreo("/Library/Twitter/Tweets/StatusesUpdate"); // Run the Choreo; when results are available, print them to serial // 901 time to wait for a Choreo response. Can be edited as needed // USE_SSL input to tell library to use HTTPS StatusesUpdateChoreo.run(901, USE_SSL); while(StatusesUpdateChoreo.available()) { char c = StatusesUpdateChoreo.read(); Serial.print(c); } StatusesUpdateChoreo.close(); } void setup() { Serial.begin(115200); // initialize serial communication WifiSettings(); Serial.println("Starting webserver on port 80"); server.begin(); // start the web server on port 80 Serial.println("Webserver started!"); PubNub.begin(pubkey, subkey); Serial.println("PubNub set up"); RF430CL(); } void loop() { // WiFiClient *client; /* Publish */ // Serial.print("publishing a message: "); aJsonObject *msg = createMessage(); char *msgStr = aJson.print(msg); aJson.deleteItem(msg); client = PubNub.publish(channel, msgStr); free(msgStr); // if (!client) { // return; // } int i = 0; WiFiClient client_1 = server.available(); // listen for incoming clients to the Web Server if (client_1) { // if you get a client, Serial.println("new client"); // print a message out the serial port char buffer[150] = { 0 }; // make a buffer to hold incoming data // make a buffer to hold incoming data (GREE_LED) while (client_1.connected()) { // loop while the client's connected if (client_1.available()) { // if there's bytes to read from the client, char c = client_1.read(); // read a byte, then Serial.write(c); // print it out the serial monitor if (c == '\n') { // if the byte is a newline character if (strlen(buffer) == 0 ) { client_1.println("HTTP/1.1 200 OK"); client_1.println("Content-Type: text/html"); client_1.println("Connection: close"); // se cierra la conexión una vez se ha respondido a la peticion client_1.println("\n Refresh: 5"); // se refresca la página automáticamente cada 5 segundos client_1.println(); client_1.println("<p>PROYECTO REALIZADO EN LAS INSTALACIONES DE LA UCLM POR "); client_1.println("\n\n"); client_1.println("<span> <strong> MOHAMED RAHALI </strong> </span><\p>"); client_1.println("\n\n"); client_1.println(); client_1.println("<!DOCTYPE HTML>"); client_1.println("<html lang='es'><head><meta charset='UTF-8'><title>"); //client_1.println("<html lang='es'>"); client_1.println("<head>"); client_1.println("<meta charset='UTF-8'>"); //client_1.println("<title>"); client_1.println("SERVICIOS MULTIMEDIA PARA EL CONTROL DE ALERTAS"); client_1.println("<hr>"); client_1.println("</title><link href='http://fonts.googleapis.com/css?family=Roboto:300|Playfair+Display:400'"); client_1.println("rel='stylesheet' type='text/css'/><link rel='stylesheet'"); client_1.println("href='http://static.tumblr.com/pjglohe/2qinf00ga/estilos.min.css'>"); client_1.println("</head><body><div class='page-wrap'><header class='header'>"); client_1.println("<h1><FONT COLOR=FBB233> SERVICIOS MULTIMEDIA PARA EL CONTROL DE ALERTAS </FONT> </h1>"); client_1.println("<hr>"); // mm cuidado h1 client_1.println("<span></H1><FONT COLOR=BLUE><strong><big><big> IoT Web SERVER </big></big></strong></FONT></H1> </span><div class='UCLM'>"); client_1.println("</br>"); client_1.println("<span>Un producto de </span>"); // cuidado aqui es diferente client_1.println("<a href='http://www3.uclm.es/etsii-cr/' target='_blank'>E.T.S.I.I-CR</a></div>"); client_1.println("<div class='Freeboard'><span>Go to </span>"); client_1.println(); // cuidado aqui es diferente client_1.println("<a href='https://freeboard.io/board/yMSkFJ' target='_blank'>Freeboard.io</a></div>"); //client_1.println("<a href='ttp://www.uclm.es/' target='_blank'>"); client_1.println("www.educachip.com"); client_1.println("</a>"); client_1.println("</div>"); client_1.println("\n\n"); //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // body Multimedia (SMS, Phone call) client_1.println("</header><section class='content-wrap'><div class='device'>"); //client_1.println("</header>"); client_1.println("<section class='content-wrap'>"); client_1.println("<div class='device'>"); client_1.println("<div class='device-name'><h2>SERVICIO MÓVILES</h2></div><div class='forms'>"); //client_1.println("<div class='device'>"); client_1.println("<div class='device-name'>"); client_1.println("<h2>"); client_1.println("LED VERDE"); client_1.println("</h2>"); client_1.println("</div>"); client_1.println("<div class='forms'>"); client_1.println("<form onClick=location.href='./Multimedia=1\' class='transition button on'>"); //client_1.println("<form class='transition button on'>"); client_1.println("<input type='button' value='SMS'/>"); client_1.println("</form></div><div class='forms'>"); //client_1.println("</form>"); client_1.println("</div>"); client_1.println("<div class='forms'>"); client_1.println("<form onClick=location.href='./Multimedia=0\' class='transition button on'>"); //client_1.println("<form class='transition button off'>"); client_1.println("<input type='button' value='LLAMADA'/>"); client_1.println("</form></div></div>"); client_1.println(); // body Email client_1.println("</header><section class='content-wrap'><div class='device'>"); //client_1.println("</header>"); client_1.println("<section class='content-wrap'>"); client_1.println("<div class='device'>"); client_1.println("<div class='device-name'><h2>MAIL</h2><div class='forms'>"); //client_1.println("<div class='device'>"); client_1.println("<div class='device-name'>"); client_1.println("<h2>"); client_1.println("LED VERDE"); client_1.println("</h2>"); client_1.println("</div>"); client_1.println("<div class='forms'>"); //aqui solo una de las dos, no todo client_1.println("<form onClick=location.href='./Mail=1\' class='transition button on'>"); //client_1.println("<form class='transition button on'>"); client_1.println("<input type='button' value='Gmail'/>"); client_1.println("</form></div><div class='forms'>"); //client_1.println("</form>"); client_1.println("</div>"); client_1.println("<div class='forms'>"); client_1.println("<form onClick=location.href='https://mail.google.com/mail/#inbox' class='transition button off'>"); //client_1.println("<form class='transition button off'>"); client_1.println("<input type='button' value='Go to Gmail'/>"); client_1.println("</form></div></div>"); client_1.println(); client_1.println("</form></div>"); // Social Media client_1.println("</header><section class='content-wrap'><div class='device'>"); //client_1.println("</header>"); client_1.println("<section class='content-wrap'>"); client_1.println("<div class='device'>"); client_1.println("<div class='device-name'><h2>Social Media</h2><div class='forms'>"); //client_1.println("<div class='device'>"); client_1.println("<div class='device-name'>"); client_1.println("<h2>"); client_1.println("LED VERDE"); client_1.println("</h2>"); client_1.println("</div>"); client_1.println("<div class='forms'>"); client_1.println("<form onClick=location.href='./Social=1\' class='transition button on'>"); //client_1.println("<form class='transition button on'>"); client_1.println("<input type='button' value='Twitter'/>"); client_1.println("</form></div><div class='forms'>"); //client_1.println("</form>"); client_1.println("</div>"); client_1.println("<div class='forms'>"); client_1.println("<form onClick=location.href='https://twitter.com/' class='transition button off'>"); //client_1.println("<form class='transition button off'>"); //client_1.println("<a href=https://twitter.com/CC3200_Posts></a>"); //client_1.println("<form class='transition button off'>"); //client_1.println("<a class="w3-btn" href=http://www.w3schools.com>Link Button</a>"); client_1.println("<input type='button' value='Go to Twitter'/>"); //client_1.println("<href=https://twitter.com/CC3200_Posts>"); client_1.println("</form></div></div>"); //client_1.println("</form>"); client_1.println("</div>"); client_1.println("<div class='forms'>"); client_1.println("</form></div>"); client_1.println("</form></div>"); client_1.println("</form></div>"); client_1.println("</form></div>"); client_1.println("</form></div>"); client_1.println(); client_1.println("</div>"); client_1.println("</form>"); client_1.println("</div>"); client_1.println("</div>"); client_1.println("</section>"); client_1.println("</div>"); client_1.println("</body>"); client_1.println("</html>"); // The HTTP response ends with another blank line: client_1.println(); // break out of the while loop: break; } else { // if you got a newline, then clear the buffer: memset(buffer, 0, 150); // memset(buffer2, 0, 150); i = 0; } } else if (c != '\r') { // if you got anything else but a carriage return character, buffer[i++] = c; // add it to the end of the currentLine //buffer2[i++] = c; } // Check to see if the client request was "GET /H" or "GET /L": if (endsWith(buffer, "GET /Multimedia=1" )) { SendSMSChoreo(); Serial.println("\nSMS was sent\n"); } if (endsWith(buffer, "GET /Multimedia=0")) { callphone(); Serial.println("\nPhone call was made"); } if (endsWith(buffer, "GET /Mail=1")) { SendEmail(); Serial.println("\nEmail was sent"); } // if (endsWith(buffer, "GET /Mail=0")) { // // } if (endsWith(buffer, "GET /Social=1")) { Sendtweets(); Serial.println("\nTwitter was updated"); // } // if (endsWith(buffer, "GET /Social=0")) { // // } } } client_1.stop(); // close the connection: Serial.println("client disonnected"); } //------------------------------------- DLP-RF430CL LOOP -------------------------------------// if (nfc.loop()) { if (nfc.wasRead()) { Serial.println("NDEF tag was read!"); } nfc.enable(); } } // //a way to check if one array ends with another array // boolean endsWith(char* inString, char* compString) { int compLength = strlen(compString); int strLength = strlen(inString); //compare the last "compLength" values of the inString int i; for (i = 0; i < compLength; i++) { char a = inString[(strLength - 1) - i]; char b = compString[(compLength - 1) - i]; if (a != b) { return false; } } return true; } //------------------------------------- printWifiStatus FUNCTION -------------------------------------// void printWifiStatus() { Serial.print("SSID: "); // print the SSID of the network you're attached to: Serial.println(WiFi.SSID()); IPAddress ip = WiFi.localIP(); // print your WiFi IP address: Serial.print("IP Address: "); Serial.println(ip); long rssi = WiFi.RSSI(); // print the received signal strength: Serial.print("signal strength (RSSI):"); Serial.print(rssi); Serial.println(" dBm"); Serial.print("To see this page in action, open a browser to http://"); // print where to go in a browser: Serial.println(ip); }
Hi all, I have a small problem, and it's the following, I'm working on an application of communication protocols, and I have TIVA hardware, CC2530 AIR MODULE, CC3100 for WIFI, I also work with a DLP-RF430CL330H.
Individually work great, but when I put them together, in a code and I mount all the boosterpack (one on top of another), it does not do anything to me, I do not even see the serial port enabled. And nothing works. And that I just copy and paste the fragments into a single code.
Could someone tell me what the problem might be? Is it some incompatibility of the plates? Or is it something of the software (power) I use?
Could I be activating things I should not have with the code?
How could I solve it? I need information or some help, it's urgent.
Thanks in advance.
I use ENEGRIA IDE. V17 . my code is:
If I may assist - while you await the "pros" you must (carefully) survey each/every BoosterPack "interconnected/chained" PINS - to insure that there are NO conflicts. (i.e. PBx "pin-chain" must "match" across each/every board w/in your board stack! {PBx must not connect to PBy - or to PCx, etc.)
It is of key/critical importance that ALL power and ground pins "carry through properly" from each/every board w/in your board stack. A mistake here can damage one or more boards!
You must perform a focused, systematic examination - of all such "interconnected pins" - across all boards. Where a "pin mis-match" is identified - you must either: (somehow "break" that flow-thru interconnect) or modify the board to "create" pin/signal agreement. (match)
It is these (unwanted) board to board "pin conflicts" which stand as "likely suspects" for your "board stack's" failure...
Cb1_mobile !! thank you for your answer, Has clarified a few things. but after looking at all the possibilities, I understand that I must go changing the location of the pins from one plate to another, or go bypassing the pins that have a different configuration on one plate than others!
How would you solve this problem ? (pic below).
Some easy solution please !!
Mohamed Rahali said:How would you solve this problem ? (pic below).
Hello friend Mohamed - you ask for a "solution" - and then (limit) it to, "easy!" And - as you surely know - not all solutions can be made, "easy." And - who defines, "easy?"
Note that I am working (strictly) from logic and (fairly long & intense) industry experience - firm/I have (never) found much interest in these "booster-packs." (i.e. have NONE!)
Should you not (tightly focus) upon two key areas:
That's a (fair) amount of time/effort for your investment - thus explains why firm/I "avoid such stacked boosts" (boosts time/effort surely) - like the plague!
Might a "better" (more inspired way) exist? As these complicating/delaying/unwanted issues are caused by, "inconsistency of signal management at connectors" perhaps that "eased, board stacking" must be rejected! (blasphemy - I know) Yet - once "freed" from "improper interconnects" cannot you properly - and far more easily - wire your "required, INDIVIDUAL, board to board connections" yourself - while NOT relying upon the (failed) board stack to, "automate" that process. While the board stack appears "efficient" (from a distance) - reality - as you've discovered - reveals serious "issues."
Often my small tech firm is called upon to create, Multiple board prototypes - and rarely (never) do we rely upon such "board stack ups" - due to the severe limitations they (always) impose!
Does this suggestion meet your "solution" (first) and then "easy" criteria? Creating a "universal board stack" without employing an "FPGA" as signal "steerer" (at each "plug-in pcb") presents high challenge...
CB1, again thank you for jumping in and helping. I agree, an easy solution may not be possible.
Mohammed,
You might consider switching to the EK-TMS4C1294XL Launchpad. It has two booster pack connectors. That gives you a lot more pins to work with. You would need to modify the code as the pins that are used change. The booster pack compatibility tool is still showing some issues, but I believe those can be overcome as described in the Anaren Integrated Radio BoosterPack user's guide. You need to look at it carefully to determine the compatibility. Also, there are some code difference between TMS4C123 and TMS4C129. See: www.ti.com/.../spma065.pdf
Bob - thank you - while acquiring data from a (very) high speed, precision BLDC Motor - I'm able to "arrive here - quickly assist if able" and then hear Excel 'beep" and discover the "next" cb1 hiccup in BLDC control. (via "intense" Cortex-R52 - which targets critical -> Autonomous Auto!)
Now - I "fear" there may be a (serious) weakness w/in the (otherwise) neat "Pin organization charts" presented. While these charts employ red (light pink) to highlight Expected, "function mismatch" - would not it prove (even) more valuable to identify ANY Pin Conflicts/Inconsistencies? (i.e. those appearing ANYWHERE along the, "Booster Pin, Plug-In, Connection Chain!)
Such seems a worthwhile "guard-band" as any (serious) pin conflict - even when - and especially when - the conflict appears (outside) of normal user application - yet may (still) harm user board(s)!
Friend Mohamed - kindly consider that this vendor (I am unattached to vendor) and multiple others - are unable to "reasonably anticipate" ALL of the potential board assemblies - which may be stacked/combined (just as you present) - in the attempt to create a, "Multi-Board Solution."
Such "multi-board assortment" provides "great flexibility" - yet adds complexity - as you've noted.
You did note success during your use of "fewer boards in combination." Could you not systematically, "Log all of those connections" then switch to the (next) succeeding board combination - and do the same?
You are "silent" with regards to my (hopefully, simplifying) suggestion to AVOID board stack - and wire individually - from board to board - in direct accord with the instruction (in highlight) I've provided here... My belief is that method will prove the quickest & easiest means for you to succeed - and that is based upon "years" of experience... Bon chance, mon ami.
Mohamed Rahali said:There will be more doubts in the future.
Cerrtainement mon ami! Would it not prove "Less Fun" if everything worked - first pass? (there is a frequent poster here - always in distress - who has converted his back-yard into a, "Power FET burial ground." Grass has long disappeared - small reptiles (often) now bear two heads - yet he works (endlessly) to get (his) board stack-up, "Just right!" Might there be a lesson there for you too - friend Mohamed?)
Perhaps - by "humoring me" - and implementing NON-STACKED boards - wired (instead) "point to point" - your "wireless dreams" will escape, "Nightmare" status... Allez mon ami!
Cordialement et enchanté,
cb1
Hello Mohamed,
I agree with cb1_mobile. What I would do is to buy two separate breadboards, place them at the left and at the right of my launchpad and then fit on each one of them each of the two booster packs. Then I would use pin-to-pin jumper-wires for all connections with EK-TM4C1294XL launchpad and that way I could be 100% sure that all needed connections are done as they should. That always works. It'll be about 30 more minutes from your time and about 7 more $, but since you are developing with those boards I think it's worth.
John.
Good John - again (at least true in your case) "great minds" think (often) alike. (Earlier this reporter suggested, "Avoid Board Stack - Wire "point to point.")
The "seduction" (ease) provided by "instant/unthinking, board-stack" comes with a high price! (Failure - which may be due to a SINGLE "chained-pin-connection" conflict!) Which - most always - is UNEXPECTED by users - who assume the board-stack to be without fault/gotcha! (one "assumes" - rather than systematically confirms - at HIGH RISK!)
Friend Mohamed may even "escape" that 7 (USD) cost by employing, "Dual ended, Square pin, 0.025", wired Female "interconnect leads" - these designed for just such, "Eased and SURE" individual, NON-STACKED connections."
"Quick, easy, & unexamined" (i.e. use of multi-board stack) too often yields "predictable" results - and these (unfortunately) - too often "outside" of expectations!
You may note that Mr. Ashara "dwells less" this space - thus his response - to such a demanding & complex task (not easy) may not meet your project's "timeline" requirements.
As friend Bruno noted - his task (Bruno's) was far simpler than yours. (only 1 pin in conflict!)
More importantly - you are learning - and (most always) your "sweating the details, yourself" - rather than pardon (passively) awaiting the "cookbook" guidance" of others - tends to elevate your capability, understanding & confidence! And that - "Worth its weight in GOLD!"
Friends (posters Bruno & John) and I all agree - you are clearly: smart, motivated & disciplined enough to systematically, "Slay the interconnect (stacked board) dragons! (by avoiding board-stack - employing instead - "individual, board to board, wired connections") You've been "well guided" here - now time to, "Cast your line - hook your fish."
Again, "Allez mon ami - allez!"
Mohamed Rahali said:what pins should I connect or how could I force them
Major term applied by cb1 is "systematically".
- Don't get distracted by "tasks that will be needed 3 minutes from now"!
- Use the basics: draw blocks on a paper sheet (one for each board), and connect them by lines (of course, one for each wire/signal) - draw one by one, only after you understand what it does and you are sure it is needed for your project.
- Then, look at the signals on each side, and check if they are in a physically matching position - I mean, can pin A17 of board P be connected to pin A17 of board Q??? If not, is there something that can be done via software to adapt it?
- If really stacking the boards later, disable everything else (configure them as open drain GPIO inputs to be sure).
It is not a bible or anything, but this concept will give you great understanding about your project and will make your goal possible.
Cheers
Bruno
Bruno - this post of yours (deserves) TEN Likes! (yet my feeble, temporarily arthritic, right index finger - can record, "Just ONE!")
While you claim "Not a bible" - your clear/complete, guided listing - comes damn CLOSE! Like, Like, Like, Like, Like.... (finger cramped)
One hopes that friend Mohamed will follow your xtal clear outline. (although this reporter - proved first/only to suggest - TRASH CAN the (FAILING) Board STACK!) Not every "vendor suggested" solution proves the BEST (nor the ONLY) solution - and may - at times - "wander" FAR from that mark! Caveat Emptor!
Let the record show that "all here" have "long ago" identified such, "Lack of compatibility."
Poster has been advised to BREAK the error-laden "Board Stack" and instead employ "Point to Point, Individual Board Wiring." Which effectively PREVENTS "compatibility issues!"
By BREAKING Board Stack is meant - "NO Boards are to be "Plugged together" via the existing header pin/socket arrays. Instead - boards should be placed nearby - and connections managed by individual "wire jumpers" (usually equipped w/ 0.025" male or female ends). In this manner - provided users ARE SYSTEMATIC & FOCUSED - improper, illegal and unwanted (FORCED) interconnects are AVOIDED!
It is so hard for (any vendor's) "Board Stack" to fully/properly ANTICIPATE ALL USER, Board Stack, COMBINATIONS!
Such led to poster's dilemma - and the proper & efficient suggestion to KILL the FAILED Board Stack!
cb1_mobile said:to include a wiring diagram - of your NON-BOARD-STACK - interconnect wiring - between your boards...
I'm unsure as to how the above can be made "more clear."
We've advised that you cannot achieve your goal by "Stacking the Boards" (i.e. plugging them into each other, one atop the other!)
There must be some description of, "which signals are to flow between each board." I've suggested that you place two boards (to start) "side by side" (NOT stacked!) and employ single wire leads which are pre-terminated w/either male or female, "0.025" pin accommodating" ends. This enables you to make direct connections between any two boards.
Get two board assemblies to work, first. (I suspect that the MCU board will (always) be common w/the others - thus MCU board to "board 1" and later MCU board to "board 2." Is that sufficiently clear? You must then load software - and test/observe for proper operation.)
When you've succeeded w/such "two board interconnected" operation (which I believe you noted - very early on) you must maintain those (same) connections between ALL three of your boards.
We can best help if you list each connection you employed when testing MCU to board 1 - and later MCU to board 2. That is of greater clarity than the vendor's "cut/paste" which you've been supplying - as we do not know (and cannot know) how you connected during your "Past description of connection success!"
You must understand that NOT EVERY PIN of each board requires an "interconnection" to meet your objective. Usually just power (proper positive & ground) and only a few (mostly serial) signals (i.e. from an I2C Port or SPI Port) require such interconnect. This has GOT TO BE DETAILED (somewhere) by this hallowed vendor.
We do not have - nor (really) understand your boards (but for the MCU board) - thus we rely upon you to find & clearly present the requested data. (the vendor's universal hook-up does NOT provide the necessary - requested detail - as I've (really) tried to present here.
I have connected this pins :
RFID ZB+TIVA C
GND GND
VCC VCC
7 7
8 16
12 12
13 39
14 9
15 10
TIVA+ZB are connected with (SPI mode.)
(TIVA+ZB) + RFID with (I2C mode)
Thank you - appreciated. Now - neither poster Bruno nor I work for this vendor. We "help" (or try to) as/if time (and in my case) limited tech knowledge - allow.
While you've responded with the requested data listing - the "shorthand-based" list provided (i.e. those 6 pins (7,8, 12-15)) are NOT Identified w/in your chart - and thus forces your "helpers" to search for, find, and then identify those pin definitions - so that we can verify those interconnects - for each board. Really - my effort here should signal that I'm not (much) lazy - yet I'm tasked w/operating a "profit center" - and steering this (extra effort) to staff is outside my best interest - don't you agree?
Better would be your creating a 3rd and 4th column - these titled, "Interconnect Pin function." I'll illustrate, below:
Note too that I've (deliberately) moved "ZB_Tiva" to the Left-most Column - as it is your Key/Critical "System MASTER" - and should list first!
ZB+Tiva ..............Function......................RFID..............................Function
(Master)......................................................(Slave)............................................
7............................MISO..............................7.....................................MISO
16..........................MOSI.............................8.....................................MOSI
(and continued/completed - by you)
Do you see how this "added detail" (i.e. identifying the functions of each pin "interconnected.") vastly assists our ability to aid you? I've never worked w/any of the boards you've chosen - thus rely upon you to fully/properly provide the "NECESSARY" (requested) Data.
Look at the beginning chart, above. I've tied "MISO to MISO" (on both devices) - which enables data exchange. (i.e. the MCU (Master) - SPI INPUT "MI" connects to the RFID (Slave) - Output "SO". You cannot transact if (either) two device outputs - or two device inputs - are directly connected!
Now - I've been hallucinating (bit more than normal) but (seem) to recall your describing, "Three Boards requiring such "Interconnect!" And your (most recent) post reveals just TWO!
There IS an advantage by "starting" with just the MCU and one other board - with your focus being, "Getting that pair to work." At some point - the chart I've described - must expand to include any other boards added to your mess (pardon) assortment.
Illustrated here is the value - and sanity maintaining ability of "KISS." Note too - Attention to Detail and "simplifying/speeding" the efforts of your humble support crue - should (maybe) "Blip your Radar."
Greetings my friend - note that Mr. B.S. has appeared (even featured) w/in several (always on point) cb1 writings... (mountaineering)
Our poster IS trying - has demonstrated effort - suspect that a "mental block" is dominating - blocking his progress. Note the (stark) contrast between a (more) proper (inclusive) chart - and one less considered.
When in doubt - List - List - List - then Check - Check - Check. Shortcuts (almost) never work - often ADD to the confusion - and further demoralize...
Firm/I have never seen - nor have (any) knowledge as to "what's what" w/poster's board "assortment." His focus is "so hard" upon his issue - he (likely) fails to anticipate our needs...
Indeed now w/you agreeing w/the PAST "3 boards in play" - I'll dial down the "anti-hallucinogenics." (at least for today... maybe)
hello all !!!
The ZB + TIVA is the set consisting of the microcontroller and the zigbee module that I have managed to connect in the form of a battery, in SPI mode (using SPI libraries). That's why I put just two columns ...
Cb1, a thousand thanks for putting up with me and letting you bother every day around here.
ZB+Tiva ..............Function......................RFID..............................Function
(Master)......................................................(Slave)............................................
7............................DATA_CLK MISO..............................7.....................................DATA_CLK MISO
16.......................... RESET MOSI.............................8..................................... RESET MOSI
12............................DATA_CLK MISO..............................12.....................................IRQ (INTO) Interrupt to microcontroller
39.......................... CS (SPI mode) ............................13.................................... SPI_CS On this line you may have some error
9............................ SCL..............................14.................................... MISO/SCL
10.......................... SDA............................15.................................... MOSI/SDA
Maybe I'm going to give up on this, because it's not something that wants to work. And the company support does not offer practical help, only theory and muuuuuuuuuuch theory.
sometimes practice is what counts ... !!!
Mohamed Rahali said:hello all !!!
Hello back Mohamed - although "all" is unlikely to extend much beyond Bruno & myself. (w/occasional, cb1staff interest)
Bother is not the issue - clarity of thought, preparation and then "presentation" is! While your latest post is (very) much improved - questions remain.
Do accept & understand that we are "many miles apart" - and this "link" is our only means to gain proper understanding. And - while you "know exactly" what you have - and how it is connected/adapted - your "outside, helper crue" does NOT! The chart I modeled is one which we (always) employ - and never fails to organize, speed and provide great insight.
I need to probe for more detail: (I need your "clear/detailed answer to each!" curse me later - after we get your system up/running)
If you are to progress well w/in engineering - this level of focus & detail (to my mind) is (very) much required! Firm/I can design/develop a pcb - w/nearly 1000 connection points - and if we, "Get ONE wrong" - we are classed as BUMS! (that's unfortunate - yet REALITY!) Many other fields are (far) less demanding.
Firm/I (always & only) succeed due to our adoption of KISS - proceed w/small, well considered & well monitored, INDIVIDUAL steps. And then critically check - catch & repair errors (early & often) those are so much "faster/easier" to find/fix EARLY - than if "missed" - and escape note until you are DONE! (in which case - due to the EXTRA time/expense/pressure of repair - many/most are truly DONE!)
I'm sorry I can not explain myself well in English. You will have noticed.
So I will not bother with my questions.
I really grateful. Cb1 and Bruno.
thanks.