Fouten bij compileren software

Arduino specifieke Software
Berichten: 1
Geregistreerd: 17 Sep 2015, 14:58

Fouten bij compileren software

Berichtdoor electro_freakz » 17 Sep 2015, 15:03

Hallo,

Ik ben sinds kort bezig met arduino en heb een aantal vragen. Ben voor een vriend wat software in een arduino aan het schieten en kom een aantal problemen tegen bij het compileren. Helaas beschik ik nog niet over de kennis om er zelf achter te komen waar het fout gaat.

Hieronder de code:
Code: Alles selecteren
#include <TinyGPS.h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

// GPS Settings
static const int RXPin = 5, TXPin = 4;
static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object
TinyGPS gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

// Variables for Maidenhead locator calculations
char* FirstCharString[]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R"};
char* MidCharString[]={"0","1","2","3","4","5","6","7","8","9"};
char* LastCharString[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x"};
float scrap; 
float loclong;
float loclat;

// the 8 arrays that form each segment of the custom numbers
byte A[8] = { B00111, B01111, B11111, B11111, B11111, B11111, B11111, B11111};
byte B[8] = { B11111, B11111, B11111, B00000, B00000, B00000, B00000, B00000};
byte C[8] = { B11100, B11110, B11111, B11111, B11111, B11111, B11111, B11111};
byte D[8] = { B11111, B11111, B11111, B11111, B11111, B11111, B01111, B00111};
byte E[8] = { B00000, B00000, B00000, B00000, B00000, B11111, B11111, B11111};
byte F[8] = { B11111, B11111, B11111, B11111, B11111, B11111, B11110, B11100};
byte G[8] = { B11111, B11111, B11111, B00000, B00000, B00000, B11111, B11111};
byte H[8] = { B11111, B00000, B00000, B00000, B00000, B11111, B11111, B11111};

char* MonthString[]={"---","jan","feb","mrt","apr","mei","jun","jul","aug","sep","okt","nov","dec"};

// Buzzer
char buzz = 2;

// voltage divider at A3  - select proper values so that voltage never exceeds 5v on Analog input !
// With R1 = 1k2 and R2 = 5k6, max input voltage = 28.33v
#define R1           (12)   // from GND to A3, express in 100R  (12 = 1200 Ohm)
#define R2           (56)   // from + power supply to A3, express in 100R  (56 = 5600 Ohm)
#define VoltSupplyMini (52) // minimum battery voltage expressed in 100mV (if lower, alarm is generated)
//unsigned int RunAvg[5]= {0,0,0,0,0};
//unsigned int AvgSupply;
//unsigned int Cnt;
unsigned int SupplyVoltage = 0; // Power supply voltage
//unsigned long BattCheck = 0;      // Battery Check Interval
 

void setup()
{
  // set up the LCD's number of columns and rows:
  lcd.begin(20, 4);
 
  // Let's start gps-ing set baudrate
  ss.begin(GPSBaud);

  // Use the pin buzz as buzzer output
  pinMode(buzz, OUTPUT);
  digitalWrite(buzz, LOW);
 
  // Assignes each segment a write number
  lcd.createChar(0,A);
  lcd.createChar(1,B);
  lcd.createChar(2,C);
  lcd.createChar(3,D);
  lcd.createChar(4,E);
  lcd.createChar(5,F);
  lcd.createChar(6,G);
  lcd.createChar(7,H);

  // Show splash screen
  lcd.clear();
  //lcd.setCursor(7, 0);
  //lcd.print("PI4RSL");
  lcd.setCursor(2, 1);
  lcd.print("GPS Velddag klok");
  lcd.setCursor(2, 2);
  lcd.print("PE2ERK '14 V1.00");
  delay (3000);
  lcd.clear();
}


void loop()
{
  // Display clock in big font
  custom(0, gps.time.hour() / 10);
  custom(1, gps.time.hour() % 10);
  custom(2, gps.time.minute() / 10);
  custom(3, gps.time.minute() % 10);
  // and the seconds
  lcd.setCursor (17,0);
  if (gps.time.second() < 10) {
    lcd.print("0");
  }   
  lcd.print(gps.time.second()); 
  //Dots between hour and min.
  //if (gps.time.second() % 2) {
    lcd.setCursor(8,0);
    lcd.print(".");
    lcd.setCursor(8,1);
    lcd.print(".");
  //} else {
  //  lcd.setCursor(8,0);
  //  lcd.print(" ");
  //  lcd.setCursor(8,1);
  //  lcd.print(" ");
  //}
  // Time is UTC
  lcd.setCursor(17,1);
  lcd.print("UTC"); 
 
  // And the rest. Date/Satellites/Locator/Altitude/Supply voltage
  lcd.setCursor(0, 2);
  printDate();
  lcd.setCursor(14, 2);
  printSat();
  lcd.setCursor(0, 3);
  printLoc();
  lcd.setCursor(8, 3);
  printAlt();
  lcd.setCursor(15,3);
  printSupply();
 
  //Feed the GPS object
  smartDelay(1000);
 
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    printNoGPS();
  }
 
//  if (gps.location.isValid() and gps.location.age() > 1500)
//  {
//   lcd.setCursor(0,3);
//   lcd.print("Fix Lost");
//   digitalWrite(buzz, HIGH);   
//   smartDelay(20);
//   digitalWrite(buzz, LOW);
//   smartDelay(1500);
//  } 
}

// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms)
{
  unsigned long start = millis();
  do
  {
    while (ss.available())
      gps.encode(ss.read());
  } while (millis() - start < ms);
}

// Calculate maidenhead locator and print on display
void printLoc(void)
{ if (gps.location.isValid())
    {
     loclong=(gps.location.lng()+180)*1000000;
     loclat=(gps.location.lat()+90)*1000000;
     //lcd.setCursor(0, 0);
     // First Character - longitude based (every 20° = 1 gridsq)     
     lcd.print(FirstCharString[int(loclong/20000000)]); 
     // Second Character - latitude based (every 10° = 1 gridsq)
     lcd.print(FirstCharString[int(loclat/10000000)]);
     // Third Character - longitude based (every 2° = 1 gridsq)       
     scrap = loclong  -   (20000000 * int (loclong/20000000));
     lcd.print(MidCharString[int(scrap*10/20/1000000)]);
     // Fourth Character - latitude based (every 1° = 1 gridsq)       
     scrap = loclat  -  (10000000 * int (loclat/10000000));   
     lcd.print(MidCharString[int(scrap/1000000)]); 
     // Fifth Character - longitude based (every 5' = 1 gridsq)       
     scrap = (loclong / 2000000)  -   (int (loclong/2000000));
     lcd.print(LastCharString[int(scrap * 24)]);
     // Sixth Character - longitude based (every 2.5' = 1 gridsq)       
     scrap = (loclat / 1000000)  -   (int (loclat/1000000));
     lcd.print(LastCharString[int(scrap * 24)]);
    } else
    { 
     lcd.print("No Fix");
    }
}

// print altitude: 5 characters long
void printAlt(void)
{
  if (gps.location.isValid())
    {
     if (int(gps.altitude.meters()) < 1000) {
       lcd.print(" ");
     }     
     if (int(gps.altitude.meters()) < 100) {
       lcd.print(" ");
     }     
     if (int(gps.altitude.meters()) < 10) {
       lcd.print(" ");
     }     
     lcd.print(int(gps.altitude.meters()));
     lcd.print('m');
    } else
    { 
     lcd.print("     ");
    }
}

// print date: 11 characters long
void printDate(void)
{
  if (gps.date.day() < 10) {
    lcd.print("0");
  }   
  lcd.print(gps.date.day());
  lcd.print(" ");
  lcd.print(MonthString[gps.date.month()]);
  lcd.print(" ");
  lcd.print(gps.date.year());
}

// Read, calculate and print Supply voltage
void printSupply (void)
{
  SupplyVoltage = analogRead(A4);       
  SupplyVoltage = map(SupplyVoltage, 0,1023,0,(50*(R2+R1)/R1));
 
  if  (SupplyVoltage >= VoltSupplyMini)   
    {
    if (SupplyVoltage < 100) {
    lcd.print(" ");
    }
    if (SupplyVoltage < 10) {
      lcd.print(" ");
    }
    lcd.print((SupplyVoltage/10), DEC);
    lcd.print(".");
    lcd.print((SupplyVoltage)%10, DEC);
    lcd.print("V"); 
  } else
  {
  lcd.print("Low V");
  digitalWrite(buzz, HIGH);  /// BEEP   
  smartDelay(20);
  digitalWrite(buzz, LOW);
  smartDelay(20);
  digitalWrite(buzz, HIGH);   
  smartDelay(20);
  digitalWrite(buzz, LOW);
  }
}

// Print number of satellites
void printSat (void)
{
  lcd.print("Sat:");
  if (gps.satellites.value() < 10) {
    lcd.print(" ");
  }
 lcd.print(gps.satellites.value());


// Error screen when no gps
void printNoGPS(void)
{
  lcd.clear();
  lcd.setCursor(4, 1);
  lcd.print("NO GPS INPUT");
  lcd.setCursor(1, 2); 
  lcd.print("CHECK  CONNECTIONS"); 
  digitalWrite(buzz, HIGH);  /// BEEP   
  delay(50);
  digitalWrite(buzz, LOW);   
  delay(1500);


void fontHelper(byte pos, byte a, byte b, byte c, byte d, byte e, byte f)
{
    lcd.setCursor(1+(pos*4), 0);  //
    lcd.write(a);
    lcd.write(b);
    lcd.write(c);
    lcd.setCursor(1+(pos*4), 1);
    lcd.write(d);
    lcd.write(e);
    lcd.write(f);
}

void custom(byte pos, byte digit)
{
  switch (digit)
  {
    case 0: fontHelper(pos, 0,1,2,3,4,5); break;
    case 1: fontHelper(pos, 1,2,32,4,255,4); break;
    case 2: fontHelper(pos, 6,6,2,3,7,7); break;
    case 3: fontHelper(pos, 6,6,2,7,7,5); break;
    case 4: fontHelper(pos, 3,4,2,32,32,255); break;
    case 5: fontHelper(pos, 255,6,6,7,7,5); break;
    case 6: fontHelper(pos, 0,6,6,3,7,5); break;
    case 7: fontHelper(pos, 1,1,2,32,0,32); break;
    case 8: fontHelper(pos, 0,6,2,3,7,5); break;
    case 9: fontHelper(pos, 0,6,2,7,7,5); break;
    }
}   



Dit zijn de fouten:
Code: Alles selecteren
Arduino: 1.6.5 (Windows 7), Board:"Arduino Nano, ATmega328"

Velddag_klok_v100.ino: In function 'void loop()':
Velddag_klok_v100:120: error: 'class TinyGPS' has no member named 'time'
Velddag_klok_v100:121: error: 'class TinyGPS' has no member named 'time'
Velddag_klok_v100:122: error: 'class TinyGPS' has no member named 'time'
Velddag_klok_v100:123: error: 'class TinyGPS' has no member named 'time'
Velddag_klok_v100:126: error: 'class TinyGPS' has no member named 'time'
Velddag_klok_v100:129: error: 'class TinyGPS' has no member named 'time'
Velddag_klok_v100:161: error: 'class TinyGPS' has no member named 'charsProcessed'
Velddag_klok_v100.ino: In function 'void printLoc()':
Velddag_klok_v100:191: error: 'class TinyGPS' has no member named 'location'
Velddag_klok_v100:193: error: 'class TinyGPS' has no member named 'location'
Velddag_klok_v100:194: error: 'class TinyGPS' has no member named 'location'
Velddag_klok_v100.ino: In function 'void printAlt()':
Velddag_klok_v100:221: error: 'class TinyGPS' has no member named 'location'
Velddag_klok_v100:223: error: 'gps.TinyGPS::altitude' does not have class type
Velddag_klok_v100:226: error: 'gps.TinyGPS::altitude' does not have class type
Velddag_klok_v100:229: error: 'gps.TinyGPS::altitude' does not have class type
Velddag_klok_v100:232: error: 'gps.TinyGPS::altitude' does not have class type
Velddag_klok_v100.ino: In function 'void printDate()':
Velddag_klok_v100:243: error: 'class TinyGPS' has no member named 'date'
Velddag_klok_v100:246: error: 'class TinyGPS' has no member named 'date'
Velddag_klok_v100:248: error: 'class TinyGPS' has no member named 'date'
Velddag_klok_v100:250: error: 'class TinyGPS' has no member named 'date'
Velddag_klok_v100.ino: In function 'void printSat()':
Velddag_klok_v100:288: error: 'gps.TinyGPS::satellites' does not have class type
Velddag_klok_v100:291: error: 'gps.TinyGPS::satellites' does not have class type
'class TinyGPS' has no member named 'time'

  Dit rapport zou meer informatie hebben met
  "Tijdens de compilatie uitgebreide uitvoer weergeven"
  ingeschakeld in Bestand > Voorkeuren.


Kan iemand mij vertellen wat hier fout gaat?

Alvast hartelijk bedankt!

Advertisement

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: Fouten bij compileren software

Berichtdoor nicoverduin » 17 Sep 2015, 19:07

Ik ken die library niet, maar ik vermoed dat je verkeerd gebruik maakt van de date en time functies. ff de documentatie nalopen.

Moet bijv. dit:
cpp code
gps.date.day()


niet dit

cpp code
gps.date.day


zijn? Het eerste suggereert een functie. Het tweede een variabele.
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Berichten: 4067
Geregistreerd: 16 Okt 2013, 14:31
Woonplaats: s hertogenbosch

Re: Fouten bij compileren software

Berichtdoor shooter » 17 Sep 2015, 22:34

of de verkeerde gps library, of je moet het woordje time etc weghalen
er is verschil tussen de tinygps en plus versie.
paul deelen
shooter@home.nl

Terug naar Arduino software

Wie is er online?

Gebruikers in dit forum: Geen geregistreerde gebruikers en 112 gasten