Go Down

Topic: GeoShield programing on arduino IDE (Read 920 times) previous topic - next topic

-u_u-

Jul 26, 2014, 12:23 am Last Edit: Jul 26, 2014, 01:28 am by -u_u- Reason: 1
hi guys..!!

I'm newbbie on arduino. Im using arduino

I have a GeoShield from liquidware and I trying to install this program in arduino



#include <Wire.h>
#include <LibCompass.h>
#include <SoftwareSerial_NB.h>
#include <LibGeoShield.h>
#include <HardwareSensor.h>
#include <stdarg.h>
#include <ctype.h>
#include <stdio.h>
#include <LibGeoShield.h>
#include <SoftwareSerial.h>
#include <Arduino.h>
#include <String.h>

/******************************************************************************
* Definitions
******************************************************************************/

#define GPS_RX_PIN 4
#define GPS_TX_PIN 5
#define GPS_BUFF_SIZE 528
#define G_SLOPE_5V      10.18
#define G_OFFSET_5V     3437

LibCompass compass = LibCompass(COMPASS_HW_GEOSHIELD);
SoftwareSerial gps = SoftwareSerial(GPS_RX_PIN, GPS_TX_PIN);
static char GPS_buff[GPS_BUFF_SIZE];

/******************************************************************************
* Constructors
******************************************************************************/

LibGeoShield::LibGeoShield(uint8_t GeoShieldType) {
  gps.begin(9600);

  _AccelGSlope = G_SLOPE_5V;  //If different supply, please calibrate
  _AccelGOffset = G_OFFSET_5V;
}

/******************************************************************************
* Global Functions
******************************************************************************/

/**********************************************************
* readGPS
*  Used to read the entire GPS sensor output into a local buffer
*
* @return char* - A pointer to the GPS data
**********************************************************/
char* LibGeoShield::readGPS(void) {
  char c;

  GPS_buffIndex = 0;
  memset(GPS_buff,0,GPS_BUFF_SIZE);
  while (1) {
    c = gps.read();
    if (c == -1) {
      break;
    }
    GPS_buff[GPS_buffIndex] = (char)c;
    GPS_buffIndex++;
  }

  return &GPS_buff[0]; //pass back a pointer to the entire buffer
}

/**********************************************************
* readCompass
*  Reads the GeoShield's on-board compass
*
* @return int - The compass heading in degrees (0-360)
**********************************************************/
int LibGeoShield::readCompass(void) {
  return (int)compass.GetHeading();
}

/**********************************************************
* setSupply
*  Set the Arduino's voltage supply. Used
*  for accelerometer volts to mg's conversion accuracy
*
* supplyVolts - The measured voltage of
*               the AREF pin, for example, 4.97
**********************************************************/
void LibGeoShield::setSupply(float supplyVolts) {
  _AccelGSlope = (supplyVolts / 5.00) * G_SLOPE_5V;
}

/**********************************************************
* readAccelX
*  Reads the GeoShield's on-board accelerometer
*
* @return int - The accelerometer position data
*                       in mg (thousands of a g)
**********************************************************/
int LibGeoShield::readAccelX(void) {
  float val;

  val = _AccelGSlope * analogRead(0) - _AccelGOffset;
  return (int)val;
}

/**********************************************************
* readAccelY
*  Reads the GeoShield's on-board accelerometer
*
* @return int - The accelerometer position data
*                       in mg (thousands of a g)
**********************************************************/
int LibGeoShield::readAccelY(void) {
  float val;

  val = _AccelGSlope * analogRead(1) - _AccelGOffset;
  return (int)val;
}

/**********************************************************
* readAccelZ
*  Reads the GeoShield's on-board accelerometer
*
* @return int - The accelerometer position data
*                       in mg (thousands of a g)
**********************************************************/
int LibGeoShield::readAccelZ(void) {
  float val;

  val = _AccelGSlope * analogRead(2) - _AccelGOffset;
  return (int)val;
}

//Export the compass functions
bool LibGeoShield::CalibrateCompass(void) {
  return compass.Calibrate();
}

void LibGeoShield::SleepCompass(void) {
  compass.Sleep();
}

void LibGeoShield::WakeCompass(void) {
  compass.Wake();
}

/**********************************************************
* ledOn
*  The GeoShield has four onboard LEDs. Use this to
*  control the GeoShield's LED.
*
*  ledNum - values are 0 - 3
**********************************************************/
void LibGeoShield::ledOn(uint8_t ledNum) {
  if ((ledNum < 0) || (ledNum > 3)) {
    return;
  }

  pinMode(ledNum+10, OUTPUT);
  digitalWrite(ledNum+10, LOW);
}

/**********************************************************
* ledOff
*  The GeoShield has four onboard LEDs. Use this to
*  control the GeoShield's LED.
*
*  ledNum - values are 0 - 3
**********************************************************/
void LibGeoShield::ledOff(uint8_t ledNum) {
  if ((ledNum < 0) || (ledNum > 3)) {
    return;
  }

  pinMode(ledNum+10, OUTPUT);
  digitalWrite(ledNum+10, HIGH);
}


but I have this  [font=Verdana]error [/font]   :smiley-eek:

In file included from /usr/share/arduino/libraries/Wire/Wire.h:26:0,
                 from /usr/share/arduino/libraries/Wire/Wire.cpp:29:
/usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:86:3: error: 'string' does not name a type
   string readString();
   ^
/usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:87:3: error: 'string' does not name a type
   string readStringUntil(char terminator);
   ^
In file included from /usr/share/arduino/libraries/Wire/Wire.cpp:29:0:
/usr/share/arduino/libraries/Wire/Wire.h:60:20: error: conflicting return type specified for 'virtual size_t TwoWire::write(uint8_t)'
     virtual size_t write(uint8_t);
                    ^
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:27:0,
                 from /usr/share/arduino/libraries/Wire/Wire.h:26,
                 from /usr/share/arduino/libraries/Wire/Wire.cpp:29:
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:38:18: error:   overriding 'virtual void Print::write(uint8_t)'
     virtual void write(uint8_t) = 0;
                  ^
In file included from /usr/share/arduino/libraries/Wire/Wire.cpp:29:0:
/usr/share/arduino/libraries/Wire/Wire.h:61:20: error: conflicting return type specified for 'virtual size_t TwoWire::write(const uint8_t*, size_t)'
     virtual size_t write(const uint8_t *, size_t);
                    ^
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:27:0,
                 from /usr/share/arduino/libraries/Wire/Wire.h:26,
                 from /usr/share/arduino/libraries/Wire/Wire.cpp:29:
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:40:18: error:   overriding 'virtual void Print::write(const uint8_t*, size_t)'
     virtual void write(const uint8_t *buffer, size_t size);
                  ^
/usr/share/arduino/libraries/Wire/Wire.cpp: In member function 'virtual size_t TwoWire::write(uint8_t)':
/usr/share/arduino/libraries/Wire/Wire.cpp:166:21: error: 'setWriteError' was not declared in this scope
       setWriteError();
                     ^

thx in advance.

Go Up