Particle dev quirks

All,
Thanks in advance for any help.
I have been struggling with a couple of issues while setting up to do some photon code.

  1. My project includes developing libraries as well as a main project so I have setup the particle dev tool since that seemed easier to work with when multiple source files are involved.
    Just dropping in my three files created a ton of problems… I added the #include “Particle.h” in my main and .h files to get all the built in stuff to work. I am currently getting the “build didn’t produce any binary files…” cant read the rest of the error… can somebody tell me how to view a build log? Saw some posts about adding a particle.include and particle .ignore file… did that with no change.
    CODE:
    main.ino
#include "blink.h"

blink blub;
void setup()
{
  // put your setup code here, to run once:
Serial.begin(9600);
Serial.println("and setup");
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
}

void loop()
{
  // put your main code here, to run repeatedly:
  blub.doABlink();
Serial.println("and looper");
delay(1000);
}

blink.h:

#include "Particle.h"

int led = D0;  // You'll need to wire an LED to this one to see it blink.
int led2 = D7; // This one is the built-in tiny one to the right of the USB jack

class blink
{
  public:
  blink();
  void doABlink();
};

blink.cpp

#include "blink.h"

  blink::blink()
  {
    return;
  }
  void
  blink::doABlink()
  {
    digitalWrite(led, HIGH);   // Turn ON the LED pins
    digitalWrite(led2, LOW);
    delay(100);               // Wait for 1000mS = 1 second
    digitalWrite(led, LOW);    // Turn OFF the LED pins
    digitalWrite(led2, HIGH);
    delay(200);               // Wait for .5 second in off mode
  }

would appreciate any help or simple example of doing a 3 file project on windows 10 using particle dev.

  1. Serial monitor is not working… more to the point, it seems that there is no serial output happening on the photon since it isn’t even working with putty. Serial output works fine with particle build.

Hope there is a simple answer out there. I’m sure there is or the whole community would be freaking out… which means this is likely my error!
thanks for your help.

Since you are including your header multiple times you need to ensure that it only ever gets actually used once.
Either by use of the common #ifndef construct or add #pragma once
And since main.ino and blink.cpp include the same header and get compiled independently both get their own set of int led/int led2 which will lead to linker errors which are not easy to see on Dev.
So you either have to make them const int led = D0 (which is good practice for consts don’t use RAM but only flash space) or you declare them in your header as

extern int led;
extern int led2;

and in your main.h

int led = D0;  // You'll need to wire an LED to this one to see it blink.
int led2 = D7; // This one is the built-in tiny one to the right of the USB jack

Which is good, since the user of your lib should have some freedom of choice.

thanks a lot for the help… guess I got tied up in my test sample… you definitely found my compile/link problem… now I need to figure out why the serial monitor is intermittent.
thanks again