First of all, I am using the seeedstudio tft shield along with an arduino uno and the seeedstudio GPRS shield v2.1.
With that out of the way I am creating a personal cellphone for everyday usage
I am almost complete with this project, having set up one way texting and calling with ease.
There is, of course, a interactive GUI to go with this.
However, when trying to set up receiving texts, I ran into several problems.
Though it seems as if my problems were solved by finding a library for the GPRS shield (can't find the link right now)the examples worked fine, but when i put them into my project the TFT does not register touches to my TEXT and CALL buttons
Namely, when a text is received it is supposed to pull up a menu showing the message, sender, and the time
below are some portion of my code, namely variable definitions and the example codes implication into my project.
Please ask if any other information is required, as I have been working in this pinch for a while, and am a newbie to these forms (I found that i had created an account sometime in the past)
thanks in advance
main definitions
//#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>
#include <SeeedTouchScreen.h>
#include <SoftwareSerial.h>
//#include <String.h>
#include <GPRS_Shield_Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <Suli.h>
#define BAUDRATE 9600
#define PIN_TX 7
#define PIN_RX 8
#define MESSAGE_LENGTH 160
GPRS gprsTest(PIN_TX, PIN_RX, BAUDRATE); //RX,TX,BaudRate
TouchScreen ts = TouchScreen(XP, YP, XM, YM);
String screen = "main"; // This will be used to find out the current screen in the loop
//String oldnumber; // Used for storing the old value to erase
String number; // Used for dialing numbers in keypad
//String oldmessage; // Used for storing old erased text message
String message; // Used for storing new text message
byte switcher = 1; // Used for controling alphabet
byte oswitcher; // Same as above; stores old value
bool lcase = true; // Used for determining the case of letters; if lcase == true then that means the next letters will be lower case
char messagee[MESSAGE_LENGTH];
int messageIndex;
char phone[16];
char datetime[24];
setup
SIM900power();
Serial.begin(9600);
while(0 != gprsTest.init()) {
delay(1000);
// Serial.print(F("init error\r\n"));
}
//Serial.println("gprs init success");
TFT_BL_ON; // turn on the background light
Tft.TFTinit(); // init TFT library
Tft.drawString("Hello Tanner!", 10, 50, 3, WHITE); // draw string: "Hello Tanner!!", (1015, 50), size: 3, color: WHITE
delay(1500); // Wait for 1.5 seconds
Tft.fillScreen(); // Clear Screen
Tft.fillRectangle(25, 150, 60, 40, BLACK); // Draw Text Button; center: (x, y), l, w, color
Tft.fillRectangle(150, 75, 60, 40, BLACK); // Draw Call Button
//Tft.fillRectangle(70, 210, 100, 50, BLACK); // Draw Contacts Button
Tft.drawString("Text", 25, 160, 2, WHITE); // draw "text" text; IMPORTANT: Make sure that the y is equal to the buttton's y + 10
Tft.drawString("Call?", 150, 75, 2, WHITE); // draw "call" text; IMPORTANT: Make sure that the y is equal to the buttton's y + 10
//Tft.drawString("Contacts", 75, 227, 2, WHITE); // draw "Contacts" text i.e contacts duh
delay(100);
main part, also, the if statement used to control the back button is the same for every button and works fine under normal circumstances
// Pulling up new SMS messages
messageIndex = gprsTest.isSMSunread();
if (screen == "readt" && p.z > __PRESURE && p.y > 300 - 40 / 2 && p.y < 300 + 40 / 2 && p.x < 25 + 60 / 2 && p.x > 25 - 60 / 2) { // If back button is pressed
Tft.fillScreen();
screen = "main"; // Set the screen value to main
Tft.fillRectangle(25, 150, 60, 40, BLACK); // Draw Text Button; center: (x, y), l, w, color
Tft.fillRectangle(150, 75, 60, 40, BLACK); // Draw Call Button
//Tft.fillRectangle(70, 210, 100, 50, BLACK); // Draw Contacts Button
Tft.drawString("Text", 25, 160, 2, WHITE); // draw "text" text; IMPORTANT: Make sure that the y is equal to the buttton's y + 10
Tft.drawString("Call?", 150, 75, 2, WHITE); // draw "call" text; IMPORTANT: Make sure that the y is equal to the buttton's y + 10
//Tft.drawString("Contacts", 75, 227, 2, WHITE); // draw "Contacts" text i.e contacts duh
} else
if (messageIndex > 0 && screen != "readt" /*&& screen == "main"*/) { //At least, there is one UNREAD SMS
Serial.println(F("Text message inbound"));
screen = "readt";
gprsTest.readSMS(messageIndex, messagee, MESSAGE_LENGTH, phone, datetime);
//In order not to full SIM Memory, is better to delete it
//Serial.print(F("From number: "));
//Serial.println(phone);
//Serial.print(F("Datetime: ")); //Tryin to save memory
//Serial.println(datetime);
//Serial.print(F("Recieved Message: "));
//Serial.println(messagee);
Tft.fillScreen();
Tft.drawString("Message Received", 10, 10, 2, WHITE);
Tft.drawString(phone, 10, 30, 2, WHITE);
Tft.drawString(datetime, 10, 50, 2, WHITE);
Tft.drawString(messagee, 10, 70, 2, WHITE);
Tft.fillRectangle(25, 300, 60, 40, BLACK); // Draw Back Button
Tft.drawString("Back", 25, 300, 2, WHITE); // draw "Back" text
gprsTest.deleteSMS(messageIndex);
} else
if (gprsTest.isSMSunread() == -1) {
Serial.println(F("SMS ERR"));
}