[SOLVED]Can't get simple InternetButton code to run properly

I’ve been successfully working with the particle on some other projects and am now trying the Button for the first time. I’m using the Particle Dev IDE. I think I’ve got some simple configuration problem.

In my source folder called ‘button’ I have InternetButton.h which I copied and pasted from the online IDE Libraries section.
I also have the following code below in a file called blink.ino
When I click Compile In Cloud, I get the error "build didn’t produce binary Error: Comm [the rest is truncated and I can’t figure out how to read it]"
I tried compiling from the CLI and I get the error message, below the source. Thanks!

#include "InternetButton.h"
InternetButton b = InternetButton();
void setup() {
    b.begin();
}
void loop() {
    b.ledOn(6, 0, 0, 255);
    delay(1000);
    b.ledOff(6);
    delay(1000);
}
Compiling code for photon

Including:
    /Users/david/weather_to_particle/button/blink.ino
    /Users/david/weather_to_particle/button/InternetButton.h
attempting to compile firmware
pushing file: /Users/david/weather_to_particle/button/blink.ino
pushing file: /Users/david/weather_to_particle/button/InternetButton.h
Errors
../../../build/target/user/platform-6/libuser.a(blink.o): In function `setup':
blink.cpp:13: undefined reference to `InternetButton::begin()'
../../../build/target/user/platform-6/libuser.a(blink.o): In function `loop':
blink.cpp:20: undefined reference to `InternetButton::ledOn(unsigned char, unsigned char, unsigned char, unsigned char)'
blink.cpp:30: undefined reference to `InternetButton::ledOff(unsigned char)'
../../../build/target/user/platform-6/libuser.a(blink.o): In function `__static_initialization_and_destruction_0':
blink.cpp:6: undefined reference to `InternetButton::InternetButton()'
collect2: error: ld returned 1 exit status
make: *** [6e75c054ae420ecc6e649fe06036b1994570c38f3d4c825936441890d494.elf] Error 1

Compile failed. Exiting.

You’ll need the InternetButton.cpp file as well. Give that a try and report back.

Thanks this gets me past any errors. The particle green LED blinks and then goes to blue pulse mode. But the #6 LED doesn’t illuminate.

Perhaps related to fact that I’m seeing a “core_firmware_xxx” file in my directory. I momentarily see a “photon_firmware_xxx” file when pushing to cloud. Is this expected behavior?

Have you selected the correct device when compiling, since that determines for which device it gets compiled?

Yes. Does this look correct?

Thanks!

Looks like that should work. If you’ve never flashed anything from the web IDE, you might want to flash a simple “blink an led” project to make sure the firmware is updated.

Turns out, I had noticed how lightly the ic socket in the Button grips the chip … I wiggled the chip a little and it works. So I think I have a defective button because of this. Thanks very much for your help.

What exactly makes you think it’s defective? The Particle device should be securely gripped into the button, it shouldn’t be loose. You can try pressing it in a bit further, while being careful not to over-do it. Also, try not to press on the metal cover on the Particle device, that might cause damage.
Can you mark this topic as [SOLVED] if you think it is, or would you mind me doing so?

It’s pushed into the socket as far as it will go. It’s loose in the socket. I don’t know how else to explain that.

Thanks.

Can you perhaps take a picture of it? That might give some more insight.

Not sure how to mark this as solved.

I think. It’s still not deep enough. The plastic ‘feet’ should be touching the PCB. The photon indeed goes in very easily, and then feels loose, but at the very end you have to press a bit firmer to get it in there. In fact, I’m struggling with getting it out of it again because it’s so firm. Try pressing on the pins with your thumbs on both sides to see if there’s any possibility of getting it in there more deeply. You shouldn’t try to crush it, but it can take a bit more force than with a breadboard for example.

I finally was able to push it into the socket. I will say the plastic case seems to prevent it from fully going into the socket so I am a lot of pushing on the buttons won’t shake it loose.

Thanks again for your assistance. I cannot find a ‘Solved’ button in the interface so I’ll just alter the title.

1 Like