Arduino + FONA + TFT + Custom Button Matrix

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
technicus
 
Posts: 12
Joined: Fri Feb 28, 2014 9:50 pm

Arduino + FONA + TFT + Custom Button Matrix

Post by technicus »

Hello, I am trying to understand how to do multi key input with the Keypad.h library. I have example code: < https://gist.github.com/Technicus/002fbf1d3def8d0317e6 > which I modified for the 3x5 button matrix that I have built which has diodes on each button. The code works exactly as intended, I am unsure how to implement it. The output is "PRESSED", "HOLD", "RELEASED", or "IDLE" and the char value for the keypress. Somewhere there needs to be a case for evaluating what to do with the result.

The purpose for this is to make a keypad for the Adafruit Fona: < https://learn.adafruit.com/adafruit-fon ... duino-test >. I have a tft screen for the interface: < https://www.adafruit.com/products/1770 >.

So there are two things I am trying to do with the software: 1. understand how to trigger events with keypad input for making calls or sending sms, 2. configure the Adafruit_Fona library for outputting to the tft rather than serial.

For sending output to tft, I found and replaced all the instances of "Serial." in the example to "tft.", but that was not enough. It looks like sending data to serial is also in the library. Will someone assist me with modifying the library and example for displaying on the tft, and help me understand how to configure multikey combinations to navigate the menu?

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Arduino + FONA + TFT + Custom Button Matrix

Post by Franklin97355 »

Could you post your code and a description or drawing of your connections between it all?
Please use the code button "</>" when submitting code

User avatar
technicus
 
Posts: 12
Joined: Fri Feb 28, 2014 9:50 pm

Re: Arduino + FONA + TFT + Custom Button Matrix

Post by technicus »

Schematic of Atmel + FONA + TFT + Keypad Matrix
Schematic of Atmel + FONA + TFT + Keypad Matrix
Atmel_FONA_TFT_Button-Matrix_Schematic_03.png (24.53 KiB) Viewed 875 times
Code that loads the tft and single button press matrix:

Code: Select all

/* @
|| @version 1.0
|| @author 
|| @contact 
||
|| @description
|| | 
|| #
*/
//#include <Adafruit_FONA.h>
#include <Keypad.h>
#include <SoftwareSerial.h>
#include <Adafruit_GFX.h>    // Core graphics library
#include <SPI.h>
#include <Adafruit_ILI9341.h>
#include <TouchScreen.h>

// For the Adafruit shield, these are the default.
#define TFT_CS 10
#define TFT_DC A0

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

// These are the four touchscreen analog pins
#define YP A2  // must be an analog pin, use "An" notation!
#define XP A3  // must be an analog pin, use "An" notation!
#define YM A4   // can be a digital pin
#define XM A5   // can be a digital pin

// This is calibration data for the raw touch data to the screen coordinates
#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940

#define MINPRESSURE 10
#define MAXPRESSURE 1000

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

// Define pins for Fona.
#define FONA_RX 0
#define FONA_TX 1
// #define FONA_RESET 10
// #define FONA_KEY 11
// #define FONA_POWERSTATUS // < not connected >
// #define FONA_NETWORKSTATUS // < not connected >
// #define FONA_RINGINDICATOR // < not connected >


const byte ROWS = 5; //four rows
const byte COLS = 3; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'},
  {'A','B','C'},
};
byte rowPins[ROWS] = {5, 6, 7, 8, 9}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {2, 3, 4}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 

void setup(){
  //Serial.begin(9600);
  //Serial.begin(115200);
  
  tft.begin();
  
  tft.fillScreen(ILI9341_BLACK);
  
   // read diagnostics (optional but can help debug problems)
  uint8_t x = tft.readcommand8(ILI9341_RDMODE);
  tft.print("Display Power Mode: 0x "); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDMADCTL);
  tft.print("\nMADCTL Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDPIXFMT);
  tft.print("\nPixel Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDIMGFMT);
  tft.print("\nImage Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDSELFDIAG);
  tft.print("\nSelf Diagnostic: 0x"); Serial.println(x, HEX); 
  
 
}
  
void loop(){
  char customKey = customKeypad.getKey();
  
  if (customKey){
    Serial.println(customKey);
    switch (customKey) {				
		case 'A':
                        Serial.println(F("Benchmark                Time (microseconds)"));
                        Serial.print(F("Screen fill              "));
                        Serial.println(testFillScreen());
                        delay(500);
			break;
		case 'B':
                        tft.fillScreen(ILI9341_BLACK);
                        tft.setCursor(0, 0);				
			break;
		case 'C':
                        Serial.println(F("Benchmark                Time (microseconds)"));
                        Serial.print(F("Text                     "));
                        Serial.println(testText());
                        delay(3000);	
			break;
                default:
                        tft.print(customKey);	
                        break;			
	}
  }
}

unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(ILI9341_BLACK);
  tft.fillScreen(ILI9341_RED);
  tft.fillScreen(ILI9341_GREEN);
  tft.fillScreen(ILI9341_BLUE);
  tft.fillScreen(ILI9341_BLACK);
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(ILI9341_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(ILI9341_RED);    tft.setTextSize(3);
  tft.println(0xDEADBEEF, HEX);
  tft.println();
  tft.setTextColor(ILI9341_GREEN);
  tft.setTextSize(5);
  tft.println("Groop");
  tft.setTextSize(2);
  tft.println("I implore thee,");
  tft.setTextSize(1);
  tft.println("my foonting turlingdromes.");
  tft.println("And hooptiously drangle me");
  tft.println("with crinkly bindlewurdles,");
  tft.println("Or I will rend thee");
  tft.println("in the gobberwarts");
  tft.println("with my blurglecruncheon,");
  tft.println("see if I don't!");
  return micros() - start;
}

Example code for multiple keypress:

Code: Select all

/* @file MultiKey.ino
|| @version 1.0
|| @author Mark Stanley
|| @contact [email protected]
||
|| @description
|| | The latest version, 3.0, of the keypad library supports up to 10
|| | active keys all being pressed at the same time. This sketch is an
|| | example of how you can get multiple key presses from a keypad or
|| | keyboard.
|| #
*/

#include <Keypad.h>

const byte ROWS = 5; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'},
  {'A','B','C'},
};
byte rowPins[ROWS] = {5, 6, 7, 8, 9}; //connect to the row pinouts of the kpd
byte colPins[COLS] = {2, 3, 4}; //connect to the column pinouts of the kpd

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

unsigned long loopCount;
unsigned long startTime;
String msg;


void setup() {
    Serial.begin(9600);
    loopCount = 0;
    startTime = millis();
    msg = "";
}


void loop() {
    loopCount++;
    if ( (millis()-startTime)>5000 ) {
        Serial.print("Average loops per second = ");
        Serial.println(loopCount/5);
        startTime = millis();
        loopCount = 0;
    }

    // Fills kpd.key[ ] array with up-to 10 active keys.
    // Returns true if there are ANY active keys.
    if (kpd.getKeys())
    {
        for (int i=0; i<LIST_MAX; i++)   // Scan the whole key list.
        {
            if ( kpd.key[i].stateChanged )   // Only find keys that have changed state.
            {
                switch (kpd.key[i].kstate) {  // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
                    case PRESSED:
                      msg = " PRESSED.";
                      break;
                    case HOLD:
                      msg = " HOLD.";
                      break;
                    case RELEASED:
                      msg = " RELEASED.";
                      break;
                    case IDLE:
                      msg = " IDLE.";
                }
                Serial.print("Key ");
                Serial.print(kpd.key[i].kchar);
                Serial.println(msg);
            }
        }
    }
}  // End loop

User avatar
technicus
 
Posts: 12
Joined: Fri Feb 28, 2014 9:50 pm

Re: Arduino + FONA + TFT + Custom Button Matrix

Post by technicus »

The goal is to convince the "FONAtest" example to display on the TFT, and navigate the menu with the custom keypad and configure multiple keypresses to activate functions of the menu. Does that clarify what I am trying to accomplish?

Here is the FONAtest example:

Code: Select all

/*************************************************** 
  This is an example for our Adafruit FONA Cellular Module

  Designed specifically to work with the Adafruit FONA 
  ----> http://www.adafruit.com/products/1946
  ----> http://www.adafruit.com/products/1963

  These displays use TTL Serial to communicate, 2 pins are required to 
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

/* 
THIS CODE IS STILL IN PROGRESS!

Open up the serial console on the Arduino at 115200 baud to interact with FONA
*/

#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"

#define FONA_RX 0//2
#define FONA_TX 1//3
#define FONA_RST A0//4

// this is a large buffer for replies
char replybuffer[255];

SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
Adafruit_FONA fona = Adafruit_FONA(&fonaSS, FONA_RST);

uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);

void setup() {
  Serial.begin(115200);
  Serial.println(F("FONA basic test"));
  Serial.println(F("Initializing....(May take 3 seconds)"));

  
  // See if the FONA is responding
  if (! fona.begin(4800)) {  // make it slow so its easy to read!
    Serial.println(F("Couldn't find FONA"));
    while (1);
  }
  Serial.println(F("FONA is OK"));

  printMenu();
}

void printMenu(void) {
   Serial.println(F("-------------------------------------"));
   Serial.println(F("[?] Print this menu"));
   Serial.println(F("[a] read the ADC (2.8V max)"));
   Serial.println(F("[b] read the Battery V"));
   Serial.println(F("[C] read the SIM CCID"));
   Serial.println(F("[U] Unlock SIM with PIN code"));
   Serial.println(F("[i] read RSSI"));
   Serial.println(F("[n] get Network status"));
   Serial.println(F("[v] set audio Volume"));
   Serial.println(F("[V] get Volume"));
   Serial.println(F("[H] set Headphone audio"));
   Serial.println(F("[e] set External audio"));
   Serial.println(F("[T] play audio Tone"));
   Serial.println(F("[f] tune FM radio"));
   Serial.println(F("[F] turn off FM"));
   Serial.println(F("[m] set FM volume"));
   Serial.println(F("[M] get FM volume"));
   Serial.println(F("[q] get FM station signal level"));
   Serial.println(F("[P] PWM/Buzzer out"));
   Serial.println(F("[c] make phone Call"));
   Serial.println(F("[h] Hang up phone"));
   Serial.println(F("[N] Number of SMSs"));
   Serial.println(F("[r] Read SMS #"));
   Serial.println(F("[R] Read All SMS"));
   Serial.println(F("[d] Delete SMS #"));
   Serial.println(F("[s] Send SMS"));
   Serial.println(F("[G] Enable GPRS"));
   Serial.println(F("[g] Disable GPRS"));
   Serial.println(F("[l] Query GSMLOC (GPRS)"));
   Serial.println(F("[w] Read webpage (GPRS)"));
   Serial.println(F("[S] create Serial passthru tunnel"));
   Serial.println(F("-------------------------------------"));
   Serial.println(F(""));
  
}
void loop() {
  Serial.print(F("FONA> "));
  while (! Serial.available() );
  
  char command = Serial.read();
  Serial.println(command);
  
  
  switch (command) {
    case '?': {
      printMenu();
      break;
    }
    
    case 'a': {
      // read the ADC
      uint16_t adc;
      if (! fona.getADCVoltage(&adc)) {
        Serial.println(F("Failed to read ADC"));
      } else {
        Serial.print(F("ADC = ")); Serial.print(adc); Serial.println(F(" mV"));
      }
      break;
    }
    
    case 'b': {
        // read the battery voltage
        uint16_t vbat;
        if (! fona.getBattVoltage(&vbat)) {
          Serial.println(F("Failed to read Batt"));
        } else {
          Serial.print(F("VBat = ")); Serial.print(vbat); Serial.println(F(" mV"));
        }
        break;
    }

    case 'U': {
        // Unlock the SIM with a PIN code
        char PIN[5];
        flushSerial();
        Serial.println(F("Enter 4-digit PIN"));
        readline(PIN, 3);
        Serial.println(PIN);
        Serial.print(F("Unlocking SIM card: "));
        if (! fona.unlockSIM(PIN)) {
          Serial.println(F("Failed"));
        } else {
          Serial.println(F("OK!"));
        }        
        break;
    }

    case 'C': {
        // read the CCID
        fona.getSIMCCID(replybuffer);  // make sure replybuffer is at least 21 bytes!
        Serial.print(F("SIM CCID = ")); Serial.println(replybuffer);
        break;
    }

    case 'i': {
        // read the RSSI
        uint8_t n = fona.getRSSI();
        int8_t r;
        
        Serial.print(F("RSSI = ")); Serial.print(n); Serial.print(": ");
        if (n == 0) r = -115;
        if (n == 1) r = -111;
        if (n == 31) r = -52;
        if ((n >= 2) && (n <= 30)) {
          r = map(n, 2, 30, -110, -54);
        }
        Serial.print(r); Serial.println(F(" dBm"));
       
        break;
    }
    
    case 'n': {
        // read the network/cellular status
        uint8_t n = fona.getNetworkStatus();
        Serial.print(F("Network status ")); 
        Serial.print(n);
        Serial.print(F(": "));
        if (n == 0) Serial.println(F("Not registered"));
        if (n == 1) Serial.println(F("Registered (home)"));
        if (n == 2) Serial.println(F("Not registered (searching)"));
        if (n == 3) Serial.println(F("Denied"));
        if (n == 4) Serial.println(F("Unknown"));
        if (n == 5) Serial.println(F("Registered roaming"));
        break;
    }
    
    /*** Audio ***/
    case 'v': {
      // set volume
      flushSerial();
      Serial.print(F("Set Vol %"));
      uint8_t vol = readnumber();
      Serial.println();
      if (! fona.setVolume(vol)) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("OK!"));
      }
      break;
    }

    case 'V': {
      uint8_t v = fona.getVolume();
      Serial.print(v); Serial.println("%");
    
      break; 
    }
    
    case 'H': {
      // Set Headphone output
      if (! fona.setAudio(FONA_HEADSETAUDIO)) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("OK!"));
      }
      fona.setMicVolume(FONA_HEADSETAUDIO, 15);
      break;
    }
    case 'e': {
      // Set External output
      if (! fona.setAudio(FONA_EXTAUDIO)) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("OK!"));
      }

      fona.setMicVolume(FONA_EXTAUDIO, 10);
      break;
    }

    case 'T': {
      // play tone
      flushSerial();
      Serial.print(F("Play tone #"));
      uint8_t kittone = readnumber();
      Serial.println();
      // play for 1 second (1000 ms)
      if (! fona.playToolkitTone(kittone, 1000)) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("OK!"));
      }
      break;
    }
    
    /*** FM Radio ***/
    
    case 'f': {
      // get freq
      flushSerial();
      Serial.print(F("FM Freq (eg 1011 == 101.1 MHz): "));
      uint16_t station = readnumber();
      Serial.println();
      // FM radio ON using headset
      if (fona.FMradio(true, FONA_HEADSETAUDIO)) {
        Serial.println(F("Opened"));
      }
     if (! fona.tuneFMradio(station)) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("Tuned"));
      }
      break;
    }
    case 'F': {
      // FM radio off
      if (! fona.FMradio(false)) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("OK!"));
      }
      break;
    }
    case 'm': {
      // Set FM volume.
      flushSerial();
      Serial.print(F("Set FM Vol [0-6]:"));
      uint8_t vol = readnumber();
      Serial.println();
      if (!fona.setFMVolume(vol)) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("OK!"));
      }
      break;
    }
    case 'M': {
      // Get FM volume.
      uint8_t fmvol = fona.getFMVolume();
      if (fmvol < 0) {
        Serial.println(F("Failed"));
      } else {
        Serial.print(F("FM volume: "));
        Serial.println(fmvol, DEC);
      }
      break;
    }
    case 'q': {
      // Get FM station signal level (in decibels).
      flushSerial();
      Serial.print(F("FM Freq (eg 1011 == 101.1 MHz): "));
      uint16_t station = readnumber();
      Serial.println();
      int8_t level = fona.getFMSignalLevel(station);
      if (level < 0) {
        Serial.println(F("Failed! Make sure FM radio is on (tuned to station)."));
      } else {
        Serial.print(F("Signal level (dB): "));
        Serial.println(level, DEC);
      }
      break;
    }
    
    /*** PWM ***/
    
    case 'P': {
      // PWM Buzzer output @ 2KHz max
      flushSerial();
      Serial.print(F("PWM Freq, 0 = Off, (1-2000): "));
      uint16_t freq= readnumber();
      Serial.println();
      if (! fona.PWM(freq)) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("OK!"));
      }
      break;
    }

    /*** Call ***/
    case 'c': {      
      // call a phone!
      char number[30];
      flushSerial();
      Serial.print(F("Call #"));
      readline(number, 30);
      Serial.println();
      Serial.print(F("Calling ")); Serial.println(number);
      if (!fona.callPhone(number)) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("Sent!"));
      }
      
      break;
    }
    case 'h': {
       // hang up! 
      if (! fona.hangUp()) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("OK!"));
      }
      break;     
    }
    
    /*** SMS ***/
    
    case 'N': {
        // read the number of SMS's!
        int8_t smsnum = fona.getNumSMS();
        if (smsnum < 0) {
          Serial.println(F("Could not read # SMS"));
        } else {
          Serial.print(smsnum); 
          Serial.println(F(" SMS's on SIM card!"));
        }
        break;
    }
    case 'r': {
      // read an SMS
      flushSerial();
      Serial.print(F("Read #"));
      uint8_t smsn = readnumber();
      
      Serial.print(F("\n\rReading SMS #")); Serial.println(smsn);
      uint16_t smslen;
      if (! fona.readSMS(smsn, replybuffer, 250, &smslen)) { // pass in buffer and max len!
        Serial.println("Failed!");
        break;
      }
      Serial.print(F("***** SMS #")); Serial.print(smsn); 
      Serial.print(" ("); Serial.print(smslen); Serial.println(F(") bytes *****"));
      Serial.println(replybuffer);
      Serial.println(F("*****"));
      
      break;
    }
    case 'R': {
      // read all SMS
      int8_t smsnum = fona.getNumSMS();
      uint16_t smslen;
      for (int8_t smsn=1; smsn<=smsnum; smsn++) {
        Serial.print(F("\n\rReading SMS #")); Serial.println(smsn);
        if (!fona.readSMS(smsn, replybuffer, 250, &smslen)) {  // pass in buffer and max len!
           Serial.println(F("Failed!"));
           break;
        }
        // if the length is zero, its a special case where the index number is higher
        // so increase the max we'll look at!
        if (smslen == 0) {
          Serial.println(F("[empty slot]"));
          smsnum++;
          continue;
        }
        
        Serial.print(F("***** SMS #")); Serial.print(smsn); 
        Serial.print(" ("); Serial.print(smslen); Serial.println(F(") bytes *****"));
        Serial.println(replybuffer);
        Serial.println(F("*****"));
      }
      break;
    }

    case 'd': {
      // delete an SMS
      flushSerial();
      Serial.print(F("Delete #"));
      uint8_t smsn = readnumber();
      
      Serial.print(F("\n\rDeleting SMS #")); Serial.println(smsn);
      if (fona.deleteSMS(smsn)) {
        Serial.println(F("OK!"));
      } else {
        Serial.println(F("Couldn't delete"));
      }
      break;
    }
    
    case 's': {
      // send an SMS!
      char sendto[21], message[141];
      flushSerial();
      Serial.print(F("Send to #"));
      readline(sendto, 20);
      Serial.println(sendto);
      Serial.print(F("Type out one-line message (140 char): "));
      readline(message, 140);
      Serial.println(message);
      if (!fona.sendSMS(sendto, message)) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("Sent!"));
      }
      
      break;
    }
    /*********************************** GPRS */
    
    case 'g': {
       // turn GPRS off
       if (!fona.enableGPRS(false))  
         Serial.println(F("Failed to turn off"));
       break;
    }
    case 'G': {
       // turn GPRS on
       if (!fona.enableGPRS(true))  
         Serial.println(F("Failed to turn on"));
       break;
    }
    case 'l': {
       // check for GSMLOC (requires GPRS)
       uint16_t returncode;
       
       if (!fona.getGSMLoc(&returncode, replybuffer, 250))
         Serial.println(F("Failed!"));
       if (returncode == 0) {
         Serial.println(replybuffer);
       } else {
         Serial.print(F("Fail code #")); Serial.println(returncode);
       }
       
       break;
    }
    case 'w': {
      // read website URL
      uint16_t statuscode;
      int16_t length;
      char url[80];
      
      flushSerial();
      Serial.println(F("NOTE: in beta! Use small webpages to read!"));
      Serial.println(F("URL to read (e.g. www.adafruit.com/testwifi/index.html):"));
      Serial.print(F("http://")); readline(url, 79);
      Serial.println(url);
      
       Serial.println(F("****"));
       if (!fona.HTTP_GET_start(url, &statuscode, (uint16_t *)&length)) {
         Serial.println("Failed!");
         break;
       }
       while (length > 0) {
         while (fona.available()) {
           char c = fona.read();
           
           // Serial.write is too slow, we'll write directly to Serial register!
           loop_until_bit_is_set(UCSR0A, UDRE0); /* Wait until data register empty. */
           UDR0 = c;
           
           length--;
           if (! length) break;
         }
       }
       Serial.println(F("\n****"));
       fona.HTTP_GET_end();
       break;
    }
    
    
    /*****************************************/
      
    case 'S': {
      Serial.println(F("Creating SERIAL TUBE"));
      while (1) {
        while (Serial.available()) {
          fona.write(Serial.read());
        }
        if (fona.available()) {
          Serial.write(fona.read());
        }
      }
      break;
    }
    
    default: {
      Serial.println(F("Unknown command"));
      printMenu();
      break;
    }
  }
  // flush input
  flushSerial();
  while (fona.available()) {
    Serial.write(fona.read());
  }

}

void flushSerial() {
    while (Serial.available()) 
    Serial.read();
}

char readBlocking() {
  while (!Serial.available());
  return Serial.read();
}
uint16_t readnumber() {
  uint16_t x = 0;
  char c;
  while (! isdigit(c = readBlocking())) {
    //Serial.print(c);
  }
  Serial.print(c);
  x = c - '0';
  while (isdigit(c = readBlocking())) {
    Serial.print(c);
    x *= 10;
    x += c - '0';
  }
  return x;
}
  
uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout) {
  uint16_t buffidx = 0;
  boolean timeoutvalid = true;
  if (timeout == 0) timeoutvalid = false;
  
  while (true) {
    if (buffidx > maxbuff) {
      //Serial.println(F("SPACE"));
      break;
    }

    while(Serial.available()) {
      char c =  Serial.read();

      //Serial.print(c, HEX); Serial.print("#"); Serial.println(c);

      if (c == '\r') continue;
      if (c == 0xA) {
        if (buffidx == 0)   // the first 0x0A is ignored
          continue;
        
        timeout = 0;         // the second 0x0A is the end of the line
        timeoutvalid = true;
        break;
      }
      buff[buffidx] = c;
      buffidx++;
    }
    
    if (timeoutvalid && timeout == 0) {
      //Serial.println(F("TIMEOUT"));
      break;
    }
    delay(1);
  }
  buff[buffidx] = 0;  // null term
  return buffidx;
}

User avatar
technicus
 
Posts: 12
Joined: Fri Feb 28, 2014 9:50 pm

Re: Arduino + FONA + TFT + Custom Button Matrix

Post by technicus »

I just realized that the Atmel pin connections are wron in the schematic. The matrix is accurate though.

User avatar
technicus
 
Posts: 12
Joined: Fri Feb 28, 2014 9:50 pm

Re: Arduino + FONA + TFT + Custom Button Matrix

Post by technicus »

Updated version.
Updated version.
Atmel_FONA_TFT_Button-Matrix_Schematic_04.png (28.8 KiB) Viewed 872 times
Here is an update of the connections.

User avatar
PlastiBots
 
Posts: 120
Joined: Fri Mar 25, 2011 7:12 pm

Re: Arduino + FONA + TFT + Custom Button Matrix

Post by PlastiBots »

Ive been working on a similar project, but using a joystick which I will use to navigate menus on the tft. Iv got code I can post (it currently posts sms messages and fona status to the tft). However, Im on vacation and dont have access to it. If yoy are still having challenges in a few days, pm me.

A few thoughts
-once I included the tft library, it worked after I changed serial.print to tft.print.
-might want to try and comment the keypad libraries and jusr focus on getting the tft to work first

User avatar
technicus
 
Posts: 12
Joined: Fri Feb 28, 2014 9:50 pm

Re: Arduino + FONA + TFT + Custom Button Matrix

Post by technicus »

I tried editing the FONAtest.ino by replacing "Serial.print" with "tft.print", but I get many errors.

Code: Select all

/*************************************************** 
  This is an example for our Adafruit FONA Cellular Module

  Designed specifically to work with the Adafruit FONA 
  ----> http://www.adafruit.com/products/1946
  ----> http://www.adafruit.com/products/1963

  These displays use TTL Serial to communicate, 2 pins are required to 
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

/* 
THIS CODE IS STILL IN PROGRESS!

Open up the serial console on the Arduino at 115200 baud to interact with FONA
*/

//#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"
#include <Adafruit_ILI9341.h>

#define FONA_RX A1//2
#define FONA_TX A2//3
#define FONA_RST A3//4

// For the Adafruit shield, these are the default.
#define TFT_CS 10
#define TFT_DC A0

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

// this is a large buffer for replies
char replybuffer[255];

//SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
//Adafruit_FONA fona = Adafruit_FONA(&fonaSS, FONA_RST);

uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);

void setup() {
  //tft.begin(115200);
  tft.begin();
  tft.println(F("FONA basic test"));
  tft.println(F("Initializing....(May take 3 seconds)"));
 
  
  // See if the FONA is responding
  if (! fona.begin(4800)) {  // make it slow so its easy to read!
    tft.println(F("Couldn't find FONA"));
    while (1);
  }
  tft.println(F("FONA is OK"));

  printMenu();
}

void printMenu(void) {
   tft.println(F("-------------------------------------"));
   tft.println(F("[?] Print this menu"));
   tft.println(F("[a] read the ADC (2.8V max)"));
   tft.println(F("[b] read the Battery V"));
   tft.println(F("[C] read the SIM CCID"));
   tft.println(F("[U] Unlock SIM with PIN code"));
   tft.println(F("[i] read RSSI"));
   tft.println(F("[n] get Network status"));
   tft.println(F("[v] set audio Volume"));
   tft.println(F("[V] get Volume"));
   tft.println(F("[H] set Headphone audio"));
   tft.println(F("[e] set External audio"));
   tft.println(F("[T] play audio Tone"));
   tft.println(F("[f] tune FM radio"));
   tft.println(F("[F] turn off FM"));
   tft.println(F("[m] set FM volume"));
   tft.println(F("[M] get FM volume"));
   tft.println(F("[q] get FM station signal level"));
   tft.println(F("[P] PWM/Buzzer out"));
   tft.println(F("[c] make phone Call"));
   tft.println(F("[h] Hang up phone"));
   tft.println(F("[N] Number of SMSs"));
   tft.println(F("[r] Read SMS #"));
   tft.println(F("[R] Read All SMS"));
   tft.println(F("[d] Delete SMS #"));
   tft.println(F("[s] Send SMS"));
   tft.println(F("[G] Enable GPRS"));
   tft.println(F("[g] Disable GPRS"));
   tft.println(F("[l] Query GSMLOC (GPRS)"));
   tft.println(F("[w] Read webpage (GPRS)"));
   tft.println(F("[S] create Serial passthru tunnel"));
   tft.println(F("-------------------------------------"));
   tft.println(F(""));
  
}
void loop() {
  tft.print(F("FONA> "));
  while (! tft.available() );
  
  char command = tft.read();
  tft.println(command);
  
  
  switch (command) {
    case '?': {
      printMenu();
      break;
    }
    
    case 'a': {
      // read the ADC
      uint16_t adc;
      if (! fona.getADCVoltage(&adc)) {
        tft.println(F("Failed to read ADC"));
      } else {
        tft.print(F("ADC = ")); tft.print(adc); tft.println(F(" mV"));
      }
      break;
    }
    
    case 'b': {
        // read the battery voltage
        uint16_t vbat;
        if (! fona.getBattVoltage(&vbat)) {
          tft.println(F("Failed to read Batt"));
        } else {
          tft.print(F("VBat = ")); tft.print(vbat); tft.println(F(" mV"));
        }
        break;
    }

    case 'U': {
        // Unlock the SIM with a PIN code
        char PIN[5];
        flushSerial();
        tft.println(F("Enter 4-digit PIN"));
        readline(PIN, 3);
        tft.println(PIN);
        tft.print(F("Unlocking SIM card: "));
        if (! fona.unlockSIM(PIN)) {
          tft.println(F("Failed"));
        } else {
          tft.println(F("OK!"));
        }        
        break;
    }

    case 'C': {
        // read the CCID
        fona.getSIMCCID(replybuffer);  // make sure replybuffer is at least 21 bytes!
        tft.print(F("SIM CCID = ")); tft.println(replybuffer);
        break;
    }

    case 'i': {
        // read the RSSI
        uint8_t n = fona.getRSSI();
        int8_t r;
        
        tft.print(F("RSSI = ")); tft.print(n); tft.print(": ");
        if (n == 0) r = -115;
        if (n == 1) r = -111;
        if (n == 31) r = -52;
        if ((n >= 2) && (n <= 30)) {
          r = map(n, 2, 30, -110, -54);
        }
        tft.print(r); tft.println(F(" dBm"));
       
        break;
    }
    
    case 'n': {
        // read the network/cellular status
        uint8_t n = fona.getNetworkStatus();
        tft.print(F("Network status ")); 
        tft.print(n);
        tft.print(F(": "));
        if (n == 0) tft.println(F("Not registered"));
        if (n == 1) tft.println(F("Registered (home)"));
        if (n == 2) tft.println(F("Not registered (searching)"));
        if (n == 3) tft.println(F("Denied"));
        if (n == 4) tft.println(F("Unknown"));
        if (n == 5) tft.println(F("Registered roaming"));
        break;
    }
    
    /*** Audio ***/
    case 'v': {
      // set volume
      flushSerial();
      tft.print(F("Set Vol %"));
      uint8_t vol = readnumber();
      tft.println();
      if (! fona.setVolume(vol)) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("OK!"));
      }
      break;
    }

    case 'V': {
      uint8_t v = fona.getVolume();
      tft.print(v); tft.println("%");
    
      break; 
    }
    
    case 'H': {
      // Set Headphone output
      if (! fona.setAudio(FONA_HEADSETAUDIO)) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("OK!"));
      }
      fona.setMicVolume(FONA_HEADSETAUDIO, 15);
      break;
    }
    case 'e': {
      // Set External output
      if (! fona.setAudio(FONA_EXTAUDIO)) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("OK!"));
      }

      fona.setMicVolume(FONA_EXTAUDIO, 10);
      break;
    }

    case 'T': {
      // play tone
      flushSerial();
      tft.print(F("Play tone #"));
      uint8_t kittone = readnumber();
      tft.println();
      // play for 1 second (1000 ms)
      if (! fona.playToolkitTone(kittone, 1000)) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("OK!"));
      }
      break;
    }
    
    /*** FM Radio ***/
    
    case 'f': {
      // get freq
      flushSerial();
      tft.print(F("FM Freq (eg 1011 == 101.1 MHz): "));
      uint16_t station = readnumber();
      tft.println();
      // FM radio ON using headset
      if (fona.FMradio(true, FONA_HEADSETAUDIO)) {
        tft.println(F("Opened"));
      }
     if (! fona.tuneFMradio(station)) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("Tuned"));
      }
      break;
    }
    case 'F': {
      // FM radio off
      if (! fona.FMradio(false)) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("OK!"));
      }
      break;
    }
    case 'm': {
      // Set FM volume.
      flushSerial();
      tft.print(F("Set FM Vol [0-6]:"));
      uint8_t vol = readnumber();
      tft.println();
      if (!fona.setFMVolume(vol)) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("OK!"));
      }
      break;
    }
    case 'M': {
      // Get FM volume.
      uint8_t fmvol = fona.getFMVolume();
      if (fmvol < 0) {
        tft.println(F("Failed"));
      } else {
        tft.print(F("FM volume: "));
        tft.println(fmvol, DEC);
      }
      break;
    }
    case 'q': {
      // Get FM station signal level (in decibels).
      flushSerial();
      tft.print(F("FM Freq (eg 1011 == 101.1 MHz): "));
      uint16_t station = readnumber();
      tft.println();
      int8_t level = fona.getFMSignalLevel(station);
      if (level < 0) {
        tft.println(F("Failed! Make sure FM radio is on (tuned to station)."));
      } else {
        tft.print(F("Signal level (dB): "));
        tft.println(level, DEC);
      }
      break;
    }
    
    /*** PWM ***/
    
    case 'P': {
      // PWM Buzzer output @ 2KHz max
      flushSerial();
      tft.print(F("PWM Freq, 0 = Off, (1-2000): "));
      uint16_t freq= readnumber();
      tft.println();
      if (! fona.PWM(freq)) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("OK!"));
      }
      break;
    }

    /*** Call ***/
    case 'c': {      
      // call a phone!
      char number[30];
      flushSerial();
      tft.print(F("Call #"));
      readline(number, 30);
      tft.println();
      tft.print(F("Calling ")); tft.println(number);
      if (!fona.callPhone(number)) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("Sent!"));
      }
      
      break;
    }
    case 'h': {
       // hang up! 
      if (! fona.hangUp()) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("OK!"));
      }
      break;     
    }
    
    /*** SMS ***/
    
    case 'N': {
        // read the number of SMS's!
        int8_t smsnum = fona.getNumSMS();
        if (smsnum < 0) {
          tft.println(F("Could not read # SMS"));
        } else {
          tft.print(smsnum); 
          tft.println(F(" SMS's on SIM card!"));
        }
        break;
    }
    case 'r': {
      // read an SMS
      flushSerial();
      tft.print(F("Read #"));
      uint8_t smsn = readnumber();
      
      tft.print(F("\n\rReading SMS #")); tft.println(smsn);
      uint16_t smslen;
      if (! fona.readSMS(smsn, replybuffer, 250, &smslen)) { // pass in buffer and max len!
        tft.println("Failed!");
        break;
      }
      tft.print(F("***** SMS #")); tft.print(smsn); 
      tft.print(" ("); tft.print(smslen); tft.println(F(") bytes *****"));
      tft.println(replybuffer);
      tft.println(F("*****"));
      
      break;
    }
    case 'R': {
      // read all SMS
      int8_t smsnum = fona.getNumSMS();
      uint16_t smslen;
      for (int8_t smsn=1; smsn<=smsnum; smsn++) {
        tft.print(F("\n\rReading SMS #")); tft.println(smsn);
        if (!fona.readSMS(smsn, replybuffer, 250, &smslen)) {  // pass in buffer and max len!
           tft.println(F("Failed!"));
           break;
        }
        // if the length is zero, its a special case where the index number is higher
        // so increase the max we'll look at!
        if (smslen == 0) {
          tft.println(F("[empty slot]"));
          smsnum++;
          continue;
        }
        
        tft.print(F("***** SMS #")); tft.print(smsn); 
        tft.print(" ("); tft.print(smslen); tft.println(F(") bytes *****"));
        tft.println(replybuffer);
        tft.println(F("*****"));
      }
      break;
    }

    case 'd': {
      // delete an SMS
      flushSerial();
      tft.print(F("Delete #"));
      uint8_t smsn = readnumber();
      
      tft.print(F("\n\rDeleting SMS #")); tft.println(smsn);
      if (fona.deleteSMS(smsn)) {
        tft.println(F("OK!"));
      } else {
        tft.println(F("Couldn't delete"));
      }
      break;
    }
    
    case 's': {
      // send an SMS!
      char sendto[21], message[141];
      flushSerial();
      tft.print(F("Send to #"));
      readline(sendto, 20);
      tft.println(sendto);
      tft.print(F("Type out one-line message (140 char): "));
      readline(message, 140);
      tft.println(message);
      if (!fona.sendSMS(sendto, message)) {
        tft.println(F("Failed"));
      } else {
        tft.println(F("Sent!"));
      }
      
      break;
    }
    /*********************************** GPRS */
    
    case 'g': {
       // turn GPRS off
       if (!fona.enableGPRS(false))  
         tft.println(F("Failed to turn off"));
       break;
    }
    case 'G': {
       // turn GPRS on
       if (!fona.enableGPRS(true))  
         tft.println(F("Failed to turn on"));
       break;
    }
    case 'l': {
       // check for GSMLOC (requires GPRS)
       uint16_t returncode;
       
       if (!fona.getGSMLoc(&returncode, replybuffer, 250))
         tft.println(F("Failed!"));
       if (returncode == 0) {
         tft.println(replybuffer);
       } else {
         tft.print(F("Fail code #")); tft.println(returncode);
       }
       
       break;
    }
    case 'w': {
      // read website URL
      uint16_t statuscode;
      int16_t length;
      char url[80];
      
      flushSerial();
      tft.println(F("NOTE: in beta! Use small webpages to read!"));
      tft.println(F("URL to read (e.g. www.adafruit.com/testwifi/index.html):"));
      tft.print(F("http://")); readline(url, 79);
      tft.println(url);
      
       tft.println(F("****"));
       if (!fona.HTTP_GET_start(url, &statuscode, (uint16_t *)&length)) {
         tft.println("Failed!");
         break;
       }
       while (length > 0) {
         while (fona.available()) {
           char c = fona.read();
           
           // tft.write is too slow, we'll write directly to Serial register!
           loop_until_bit_is_set(UCSR0A, UDRE0); /* Wait until data register empty. */
           UDR0 = c;
           
           length--;
           if (! length) break;
         }
       }
       tft.println(F("\n****"));
       fona.HTTP_GET_end();
       break;
    }
    
    
    /*****************************************/
      
    case 'S': {
      tft.println(F("Creating SERIAL TUBE"));
      while (1) {
        while (tft.available()) {
          fona.write(tft.read());
        }
        if (fona.available()) {
          tft.write(fona.read());
        }
      }
      break;
    }
    
    default: {
      tft.println(F("Unknown command"));
      printMenu();
      break;
    }
  }
  // flush input
  flushSerial();
  while (fona.available()) {
    tft.write(fona.read());
  }

}

void flushSerial() {
    while (tft.available()) 
    tft.read();
}

char readBlocking() {
  while (!tft.available());
  return tft.read();
}
uint16_t readnumber() {
  uint16_t x = 0;
  char c;
  while (! isdigit(c = readBlocking())) {
    //tft.print(c);
  }
  tft.print(c);
  x = c - '0';
  while (isdigit(c = readBlocking())) {
    tft.print(c);
    x *= 10;
    x += c - '0';
  }
  return x;
}
  
uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout) {
  uint16_t buffidx = 0;
  boolean timeoutvalid = true;
  if (timeout == 0) timeoutvalid = false;
  
  while (true) {
    if (buffidx > maxbuff) {
      //tft.println(F("SPACE"));
      break;
    }

    while(tft.available()) {
      char c =  tft.read();

      //tft.print(c, HEX); tft.print("#"); tft.println(c);

      if (c == '\r') continue;
      if (c == 0xA) {
        if (buffidx == 0)   // the first 0x0A is ignored
          continue;
        
        timeout = 0;         // the second 0x0A is the end of the line
        timeoutvalid = true;
        break;
      }
      buff[buffidx] = c;
      buffidx++;
    }
    
    if (timeoutvalid && timeout == 0) {
      //tft.println(F("TIMEOUT"));
      break;
    }
    delay(1);
  }
  buff[buffidx] = 0;  // null term
  return buffidx;
}

Code: Select all

In file included from FONAtest_01.ino:25:
/home/Technician/sketchbook/libraries/Adafruit_FONA/Adafruit_FONA.h:50: error: expected `)' before ‘*’ token
/home/Technician/sketchbook/libraries/Adafruit_FONA/Adafruit_FONA.h:139: error: ISO C++ forbids declaration of ‘SoftwareSerial’ with no type
/home/Technician/sketchbook/libraries/Adafruit_FONA/Adafruit_FONA.h:139: error: expected ‘;’ before ‘*’ token
In file included from FONAtest_01.ino:26:
/home/Technician/sketchbook/libraries/Adafruit_ILI9341/Adafruit_ILI9341.h:100: error: expected class-name before ‘{’ token
FONAtest_01.ino: In function ‘void setup()’:
FONAtest_01:52: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:53: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:57: error: ‘fona’ was not declared in this scope
FONAtest_01:58: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:61: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01.ino: In function ‘void printMenu()’:
FONAtest_01:67: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:68: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:69: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:70: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:71: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:72: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:73: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:74: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:75: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:76: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:77: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:78: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:79: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:80: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:81: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:82: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:83: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:84: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:85: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:86: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:87: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:88: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:89: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:90: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:91: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:92: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:93: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:94: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:95: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:96: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:97: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:98: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:99: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01.ino: In function ‘void loop()’:
FONAtest_01:103: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:104: error: ‘class Adafruit_ILI9341’ has no member named ‘available’
FONAtest_01:106: error: ‘class Adafruit_ILI9341’ has no member named ‘read’
FONAtest_01:107: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:119: error: ‘fona’ was not declared in this scope
FONAtest_01:120: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:122: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:122: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:122: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:130: error: ‘fona’ was not declared in this scope
FONAtest_01:131: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:133: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:133: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:133: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:142: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:144: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:145: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:146: error: ‘fona’ was not declared in this scope
FONAtest_01:147: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:149: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:156: error: ‘fona’ was not declared in this scope
FONAtest_01:157: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:157: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:163: error: ‘fona’ was not declared in this scope
FONAtest_01:166: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:166: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:166: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:173: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:173: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:180: error: ‘fona’ was not declared in this scope
FONAtest_01:181: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:182: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:183: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:184: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:185: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:186: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:187: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:188: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:189: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:197: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:199: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:200: error: ‘fona’ was not declared in this scope
FONAtest_01:201: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:203: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:209: error: ‘fona’ was not declared in this scope
FONAtest_01:210: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:210: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:217: error: ‘fona’ was not declared in this scope
FONAtest_01:218: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:220: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:222: error: ‘fona’ was not declared in this scope
FONAtest_01:227: error: ‘fona’ was not declared in this scope
FONAtest_01:228: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:230: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:233: error: ‘fona’ was not declared in this scope
FONAtest_01:240: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:242: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:244: error: ‘fona’ was not declared in this scope
FONAtest_01:245: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:247: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:257: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:259: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:261: error: ‘fona’ was not declared in this scope
FONAtest_01:262: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:264: error: ‘fona’ was not declared in this scope
FONAtest_01:265: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:267: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:273: error: ‘fona’ was not declared in this scope
FONAtest_01:274: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:276: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:283: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:285: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:286: error: ‘fona’ was not declared in this scope
FONAtest_01:287: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:289: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:295: error: ‘fona’ was not declared in this scope
FONAtest_01:297: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:299: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:300: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:307: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:309: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:310: error: ‘fona’ was not declared in this scope
FONAtest_01:312: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:314: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:315: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:325: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:327: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:328: error: ‘fona’ was not declared in this scope
FONAtest_01:329: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:331: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:341: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:343: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:344: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:344: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:345: error: ‘fona’ was not declared in this scope
FONAtest_01:346: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:348: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:355: error: ‘fona’ was not declared in this scope
FONAtest_01:356: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:358: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:367: error: ‘fona’ was not declared in this scope
FONAtest_01:369: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:371: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:372: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:379: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:382: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:382: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:384: error: ‘fona’ was not declared in this scope
FONAtest_01:385: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:388: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:388: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:389: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:389: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:389: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:390: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:391: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:397: error: ‘fona’ was not declared in this scope
FONAtest_01:400: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:400: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:402: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:408: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:413: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:413: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:414: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:414: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:414: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:415: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:416: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:424: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:427: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:427: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:428: error: ‘fona’ was not declared in this scope
FONAtest_01:429: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:431: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:440: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:442: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:443: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:445: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:446: error: ‘fona’ was not declared in this scope
FONAtest_01:447: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:449: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:458: error: ‘fona’ was not declared in this scope
FONAtest_01:459: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:464: error: ‘fona’ was not declared in this scope
FONAtest_01:465: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:472: error: ‘fona’ was not declared in this scope
FONAtest_01:473: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:475: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:477: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:477: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:489: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:490: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:491: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:492: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:494: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:495: error: ‘fona’ was not declared in this scope
FONAtest_01:496: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:500: error: ‘fona’ was not declared in this scope
FONAtest_01:511: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:512: error: ‘fona’ was not declared in this scope
FONAtest_01:520: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:522: error: ‘class Adafruit_ILI9341’ has no member named ‘available’
FONAtest_01:523: error: ‘fona’ was not declared in this scope
FONAtest_01:523: error: ‘class Adafruit_ILI9341’ has no member named ‘read’
FONAtest_01:525: error: ‘fona’ was not declared in this scope
FONAtest_01:526: error: ‘class Adafruit_ILI9341’ has no member named ‘write’
FONAtest_01:533: error: ‘class Adafruit_ILI9341’ has no member named ‘println’
FONAtest_01:540: error: ‘fona’ was not declared in this scope
FONAtest_01:541: error: ‘class Adafruit_ILI9341’ has no member named ‘write’
FONAtest_01.ino: In function ‘void flushSerial()’:
FONAtest_01:547: error: ‘class Adafruit_ILI9341’ has no member named ‘available’
FONAtest_01:548: error: ‘class Adafruit_ILI9341’ has no member named ‘read’
FONAtest_01.ino: In function ‘char readBlocking()’:
FONAtest_01:552: error: ‘class Adafruit_ILI9341’ has no member named ‘available’
FONAtest_01:553: error: ‘class Adafruit_ILI9341’ has no member named ‘read’
FONAtest_01.ino: In function ‘uint16_t readnumber()’:
FONAtest_01:561: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01:564: error: ‘class Adafruit_ILI9341’ has no member named ‘print’
FONAtest_01.ino: In function ‘uint8_t readline(char*, uint8_t, uint16_t)’:
FONAtest_01:582: error: ‘class Adafruit_ILI9341’ has no member named ‘available’
FONAtest_01:583: error: ‘class Adafruit_ILI9341’ has no member named ‘read’

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino + FONA + TFT + Custom Button Matrix

Post by adafruit_support_mike »

Whenever you get a long sequence of errors like that, ignore everything after the first 5-10 lines.

Compiler failures are kind of like that thing with the ping pong balls and mousetraps. There's a lot of activity, most of which is triggered by the debris from something that broke earlier. The first few errors tell you where the trouble started.

In this case, it looks like the system can't find the SoftwareSerial library which should be included by a statement at the top of Adafruit_FONA.h

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”