# SparkFun Photon Weather Shield Particle Library

**URL:** <https://community.particle.io/t/sparkfun-photon-weather-shield-particle-library/25085>\
**Category:** Libraries\
**Created:** [August 12, 2016, 9:11pm UTC](https://community.particle.io/t/sparkfun-photon-weather-shield-particle-library/25085 "2016-08-12T21:11:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaapdemaat](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jaapdemaat/32/6463_2.png) [@jaapdemaat](https://community.particle.io/u/jaapdemaat)\
**Post date:** [August 12, 2016, 9:11pm UTC](https://community.particle.io/t/sparkfun-photon-weather-shield-particle-library/25085/1 "2016-08-12T21:11:30Z")

</div>

Hi All,  
Im working on a project building a weather station using the [Photon Weather Shield Hookup Guide](https://learn.sparkfun.com/tutorials/photon-weather-shield-hookup-guide/example-1-getting-started--reading-the-on-board-sensors) but am completely stuck.  
I get the following errors when verifying the code while using the most [basic code provided](https://learn.sparkfun.com/tutorials/photon-weather-shield-hookup-guide/-particle-libraries-and-the-particle-ide).  
Anyone have any idea what this might be?  
Many thanks,

```nohighlight
ERROR:
SparkFun_Photon_Weather_Shield_Library.cpp: In member function 'float Weather::readPressure()':
SparkFun_Photon_Weather_Shield_Library.cpp:320:22: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
  if(IIC_Read(STATUS) & (1<<2) == 0) toggleOneShot(); //Toggle the OST bit causing the sensor to immediately take another reading
                      ^
SparkFun_Photon_Weather_Shield_Library.cpp:324:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
  while(IIC_Read(STATUS) & (1<<2) == 0)
                         ^
SparkFun_Photon_Weather_Shield_Library.cpp: In member function 'float Weather::readBaroTemp()':
SparkFun_Photon_Weather_Shield_Library.cpp:360:22: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
  if(IIC_Read(STATUS) & (1<<1) == 0) toggleOneShot(); //Toggle the OST bit causing the sensor to immediately take another reading
                      ^
jdm-weather.cpp: In function 'void setup()':
jdm-weather.cpp:63:32: warning: 'Spark' is deprecated (declared at ../wiring/inc/spark_wiring_cloud.h:357): Spark is now Particle. [-Wdeprecated-declarations]
 {
                                ^
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp: In member function 'float Weather::readPressure()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:320:22: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
  if(IIC_Read(STATUS) & (1<<2) == 0) toggleOneShot(); //Toggle the OST bit causing the sensor to immediately take another reading
                      ^
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:324:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
  while(IIC_Read(STATUS) & (1<<2) == 0)
                         ^
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp: In member function 'float Weather::readBaroTemp()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:360:22: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
  if(IIC_Read(STATUS) & (1<<1) == 0) toggleOneShot(); //Toggle the OST bit causing the sensor to immediately take another reading
                      ^
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::heaterOff()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:49: multiple definition of `Weather::Weather()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:49: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::heaterOff()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:49: multiple definition of `Weather::Weather()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:49: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `PublishFlag':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:193: multiple definition of `Weather::checkID()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:193: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::makeMeasurment(unsigned char)':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:210: multiple definition of `Weather::makeMeasurment(unsigned char)'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:210: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::getRH()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:105: multiple definition of `Weather::getRH()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:105: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::readTemp()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:113: multiple definition of `Weather::readTemp()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:113: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::readTempF()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:129: multiple definition of `Weather::readTempF()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:129: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::getTemp()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:121: multiple definition of `Weather::getTemp()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:121: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::getTempF()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:134: multiple definition of `Weather::getTempF()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:134: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::writeReg(unsigned char)':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:250: multiple definition of `Weather::writeReg(unsigned char)'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:250: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::reset()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:189: multiple definition of `Weather::reset()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:189: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::readReg()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:259: multiple definition of `Weather::readReg()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:259: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::heaterOn()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:140: multiple definition of `Weather::heaterOn()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:140: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::heaterOff()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:149: multiple definition of `Weather::heaterOff()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:149: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::changeResolution(unsigned char)':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:157: multiple definition of `Weather::changeResolution(unsigned char)'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:157: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::IIC_Read(unsigned char)':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:490: multiple definition of `Weather::IIC_Read(unsigned char)'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:490: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::begin()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:52: multiple definition of `Weather::begin()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:52: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::IIC_Write(unsigned char, unsigned char)':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:500: multiple definition of `Weather::IIC_Write(unsigned char, unsigned char)'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:500: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::setModeBarometer()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:419: multiple definition of `Weather::setModeBarometer()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:419: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::setModeAltimeter()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:428: multiple definition of `Weather::setModeAltimeter()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:428: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::setModeStandby()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:437: multiple definition of `Weather::setModeStandby()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:437: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::setModeActive()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:446: multiple definition of `Weather::setModeActive()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:446: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::setOversampleRate(unsigned char)':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:457: multiple definition of `Weather::setOversampleRate(unsigned char)'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:457: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::enableEventFlags()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:471: multiple definition of `Weather::enableEventFlags()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:471: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::toggleOneShot()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:477: multiple definition of `Weather::toggleOneShot()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:477: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::readAltitude()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:273: multiple definition of `Weather::readAltitude()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:273: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::readAltitudeFt()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:310: multiple definition of `Weather::readAltitudeFt()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:310: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::readPressure()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:318: multiple definition of `Weather::readPressure()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:318: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::readBaroTemp()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:359: multiple definition of `Weather::readBaroTemp()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:359: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o): In function `Weather::readBaroTempF()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:412: multiple definition of `Weather::readBaroTempF()'
../../../build/target/user/platform-6/libuser.a(SparkFun_Photon_Weather_Shield_Library.o):SparkFun_Photon_Weather_Shield_Library.cpp:412: first defined here
collect2: error: ld returned 1 exit status
make: *** [cc67add129e7c6ca93fbab0ea3d1bd748a23eb498bc85e470d2a7d3e6b89.elf] Error 1

```

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [August 12, 2016, 9:33pm UTC](https://community.particle.io/t/sparkfun-photon-weather-shield-particle-library/25085/2 "2016-08-12T21:33:15Z")

</div>

You seem to be importing a library twice.

What IDE are you using?

Instead of linking to a page and expecting us to search for _“the most basic code provided”_ just post the code or provide a direct link!

If I use the sample that comes with the lib it builds just fine  
[https://build.particle.io/libs/564a16203532208b190005b0/tab/SparkFun\_Photon\_Weather\_Shield\_Example.ino](https://build.particle.io/libs/564a16203532208b190005b0/tab/SparkFun_Photon_Weather_Shield_Example.ino)

---

<div class="post-metadata">

**Author:** ![jaapdemaat](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jaapdemaat/32/6463_2.png) [@jaapdemaat](https://community.particle.io/u/jaapdemaat)\
**Post date:** [August 12, 2016, 10:13pm UTC](https://community.particle.io/t/sparkfun-photon-weather-shield-particle-library/25085/3 "2016-08-12T22:13:20Z")

</div>

Hi @ScruffR thanks for your quick reply.

Im not really an expert and I clearly did something wrong 😑

I’ve use the lib your provided and no more errors!  
No data appearing yet in the console Logs, which is the next thing Im going to look into.  
Might ask you for some tips and tricks in case I get stuck again, if that ok with you.

How far did you get with your weather station?  
Got it uploading to [Wunderground.com](http://Wunderground.com) yet?

Im using the online Build IDE.  
Thanks again, much appreciated your input!

---

<div class="post-metadata">

**Author:** ![jaapdemaat](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jaapdemaat/32/6463_2.png) [@jaapdemaat](https://community.particle.io/u/jaapdemaat)\
**Post date:** [August 12, 2016, 10:31pm UTC](https://community.particle.io/t/sparkfun-photon-weather-shield-particle-library/25085/4 "2016-08-12T22:31:16Z")

</div>

I can actually see some data coming in using the serial monitor in the Dev app.  
(Photon connected with USB)

Very very satisfying already 🕶  
j
