-1

I am receiving an "Error 1" when using particle io relay - I am using the same exact firmware found here: https://github.com/spark/relayshield. What do I need to change?

1_Blink_a_Relay.cpp:2:37: fatal error: RelayShield/RelayShield.h: No such file or directory
#include "RelayShield/RelayShield.h"
runningraptor
  • 339
  • 1
  • 6
  • 19
  • Ryan Jin, below answered my question correctly. Even though in the code I inlcuded the RelayShield library, I have to click the button "Include in App" within the application to truly add the Particle RelayShield library. I find this redundant since I am within their text editor. But it now works and I no longer get the error message. – runningraptor Jul 27 '16 at 17:01

2 Answers2

0

It looks like your code can't find the library you're trying to import. Often (and especially when adapting Arduino code for Particle), the folder name for a library needs to be removed. Try #include "RelayShield.h instead.

If that doesn't work, please provide a little more information, such as your development environment. (Are you using Particle's web-based IDE? Did you import the library from there?)

Cheers!

hxlnt
  • 618
  • 7
  • 7
  • Thank you for the response. I was using the Particle IDE - build.particle.io. Even though I did include the library at the top, I have to then within the particle IDE click the "Include in App" button. As you suspected, I was in fact saving code in Arduino IDE on my computer, so I could save the code. Then at a later date I would copy the code from Ardunio IDE and paste it into Particle Build. So now I still do that but ensure to click the aforementioned button so the library is included. I don't understand why having the #include is not sufficient. Thanks for answering! – runningraptor Jul 27 '16 at 17:07
0

If you are using the web ide, the one at build.particle.io, then you have to include the library. You have to go to the fifth item on the left menu bar, after flash, compile, save, and code. It should say library, and looks like a bookmark. Click on that. It will pop out a view. Scroll down until you see the Community Library search bar. And search for RelayShield. It will show you the "RELAYSHIELD", which currently is used by 520 people (or something like that). Click on that, and it will open the library. Scroll down on the left side (the one that pops up) until you see the button "Include in App". Click on that, and select your app. After you click on that, it will bring up your app. Then scroll down on that popped out view, until you see "Add to this App". Just click on this button, and then it will include that library in your project.

For Particle Dev on Desktop, it is a lot harder. If you are using Particle Dev, please reply, and I will give you the solution for that. It is very hard to manage libraries with Particle Dev. However, if you want to use the Serial Monitor while using the Particle Build on the internet, what you can do is that you do the regular serial commands on the Particle Build (build.particle.io), and open the Serial monitor on Particle Dev after also connecting to your Particle photon

Ryan Jin
  • 119
  • 1
  • 8
  • Thank you. I was in fact using: #include "RelayShield/RelayShield.h" and was using the build.particle.io and was getting that error message. The build.particle.io doesn't let you save multiple programs in the cloud (just shows what you have done lately, if you "x" out of the sheet its gone). So I was getting the code saving in a file on my computer and later copying and pasting into the build.particle.io. So each time I need to remember to do the "Include in App" in order for it to recognize #include "RelayShield/RelayShield.h" Thank you for your detailed response! – runningraptor Jul 27 '16 at 16:56