SIK Photon Redboard Program Uploads do not work!

I’ve copied the code from the “Experiment 4: Color Selector” program exactly as is and uploaded to the Redboard. I’ve verified the wiring several times as well. But the code just does not seem to upload. The simple D7 LED program uploads easily and works (i’ve tried several blink lengths to verify this).

What could be going wrong? This is frustrating me no end!

The Sparkfun Photon Redboard uses a P1 module, and not a P0 (the one in a Photon). Are you compiling your code for the P1?

Yes, I am compiling the code for P1

Could you please share the code that you are trying to use?

Putting your code inside of


Makes it look nice.

/*  SparkFun Inventor's Kit for Photon
    Experiment 4 - Part 1
    This sketch was written by SparkFun Electronics
    Ben Leduc-Mills
    August 31, 2015

    This is an example sketch using buttons and a potentiometer to change the color and brightness of the Photon RedBoard onboard LED.

    Development environment specifics:
    Particle Build environment (
    Particle Photon RedBoard
    Released under the MIT License(
int redButton = D2; // declare variable for red button
int greenButton = D3; // declare variable for green button
int blueButton = D4; // declare variable for blue button

int potentiometer = A0; // declare variable for potentiometer
int colorMode; // declare variable to keep track of color
int potValue = 0; // // declare variable for the value of the potentiometer

void setup() {

    RGB.control(true); // command to control the RGB led on the Photon
    // buttons need an internal pullup resistor - see below for notes
    pinMode(redButton, INPUT_PULLUP);
    pinMode(greenButton, INPUT_PULLUP);
    pinMode(blueButton, INPUT_PULLUP);
    pinMode(potentiometer, INPUT); // potentiometers are an analog input
    colorMode = 0;


void loop() {

    // change colorMode variable depending on which button was pressed
    if(digitalRead(redButton) == LOW) { // double equals checks for equality
        colorMode = 1; // single equals is for assigning a new value to the variable

    if(digitalRead(greenButton) == LOW) {
        colorMode = 2;

    if(digitalRead(blueButton) == LOW) {
        colorMode = 3;

    // read from the potentiometer, divide by 16 to get a number we can use for a color value
    potValue = analogRead(potentiometer)/16;
    changeColor(colorMode, potValue); // call changeColor function


// changeColor takes a color mode and a potentiometer value and changes the color and brightness of the Photon RGB LED
void changeColor(int _colorMode, int _potValue) {

    if(_colorMode == 1) {
        RGB.color(_potValue, 0, 0);

    if(_colorMode == 2) {
        RGB.color(0, _potValue, 0);

    if(_colorMode == 3) {
        RGB.color(0, 0, _potValue);

    else if(colorMode == 0) {

Are you sure that you have wired everything correctly?

I think the code is uploading, but it is not behaving as you are expecting because either the code or your wiring needs to be corrected.

What happens if you add code to setup for the D7 LED turn on? If D7 turns on, the code is uploading properly.

Very strange. I used and pasted in the code from the [original post] ( and selected my RedBoard in the Devices icon. I was able to flash successfully (board running 0.5.2) and it worked properly. I didn’t connect anything to the board, so I could not test the potentiometer, but after booting the RGB LED turned off and then touching D2, D3, or D4 to GND changed the color.

Added this piece in the loop section, still does not work!

// Test
  digitalWrite(D7, HIGH);
  digitalWrite(D7, LOW);
// End Test

Did you remember to put pinMode(D7, OUTPUT); in setup?

Which build environment are you using? Particle Build (Web IDE), Particle Dev (Atom IDE), or Particle CLI? If using Dev, could you take a screenshot of the window?

Yes, did all that. Also, FYI, code loads OK onto the board. For example, the simple blinking program loads and works. It appears that there is some issue with this code…this code compiles and uploads successfully, but does not run. Even the simple led blink piece of the code is not running.

Particle Dev Atom.

Thanks for the picture. I think there are two things going on here: The first is that Particle Dev does not build the file that’s in the frontmost tab. It builds all of the files in the directory the the file you first opened is contained in. So pretty much you need to make a separate directory for each project within your “Sparkfun Projects” directory, then put a separate .ino file in each directory.

The second is that I don’t think that RGB Buttons has a filename extension. This is why you’re not getting a build error; it’s being treated as a text file not a source code file and is being ignored. That’s why the syntax highlighting (other than links) is missing.


OK, thanks. It certainly did not have an extension, so I saved it with a .ino extension in a new folder with the same filename. Now, when I compile, I get a “build didn’t produce binary” error.

1 Like

Thanks man! I went back and ensured that the other .ino program was not in the Particle Dev environment when compiling the RGB code and it worked great this time! Thanks again!