# BLINK LED Example: Electron

**URL:** <https://community.particle.io/t/blink-led-example-electron/24730>\
**Category:** Troubleshooting\
**Created:** [July 30, 2016, 3:10pm UTC](https://community.particle.io/t/blink-led-example-electron/24730 "2016-07-30T15:10:45Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlingeh](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rlingeh/32/10895_2.png) [@rlingeh](https://community.particle.io/u/rlingeh)\
**Post date:** [July 30, 2016, 3:10pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/1 "2016-07-30T15:10:45Z")

</div>

Hello, we are getting started with Electron but this very first simple example doesn’t work. I have done all as described here: [https://docs.particle.io/guide/getting-started/examples/electron/](https://docs.particle.io/guide/getting-started/examples/electron/)

These are the steps I took:

1. The LED and resistor were connected as on the diagram in the link above
2. The code was copied and put in a file blink.ino and compiled using CLI: particle compile electron blink.ino
3. The compilation generated electron\_firmware\_1469880834091.bin
4. This file was copied to the Electron with the command  
particle flash --serial electron\_firmware\_1469880834091.bin  
The device signaled the copy was successful but nothing happens to the connected LED. It didn’t blink at all. I tried all option to no avail. What could be the cause of this?

---

<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:** [July 30, 2016, 4:36pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/2 "2016-07-30T16:36:37Z")

</div>

It’s fine to say everything was done as instructed, but there might still be traps.  
Have you checked the polarity of the LED?  
Does to pin you connected the LED to really fit the code? Sometimes people had the LED connected one pin off due to the pin names being printed between pins.  
Could you post a pic of your setup?

---

<div class="post-metadata">

**Author:** ![rlingeh](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rlingeh/32/10895_2.png) [@rlingeh](https://community.particle.io/u/rlingeh)\
**Post date:** [July 30, 2016, 7:10pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/3 "2016-07-30T19:10:01Z")

</div>

Thanks for the reply. Here is the requested image. You will see the LED is connected to D6 and then to GND through the resistor.

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/4/4ee22e6df597fcb87f6b5eb67249aea63ae6085e.JPG)

---

<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:** [July 30, 2016, 7:20pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/4 "2016-07-30T19:20:33Z")

</div>

One thing that puzzles me is the green RGB LED. Does it ever turn breathing cyan?  
If not, your code won’t execute till this happens.

And next, I can’t see the polarity of the LED, since exactly that part is out of focus 😉

What happens if you touch the D6 pin briefly with a jumper wire coming from the 3V3 pin?  
Does the LED light up?

---

<div class="post-metadata">

**Author:** ![rlingeh](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rlingeh/32/10895_2.png) [@rlingeh](https://community.particle.io/u/rlingeh)\
**Post date:** [July 30, 2016, 7:32pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/5 "2016-07-30T19:32:49Z")

</div>

OK!! I think that’s the issue. I have tried to get the RGB LED breathing cyan to no avail. Reading through the doc, I found out that the SIM card must be activated before this LED can breath cyan. The SIM card is not yet activated because I am still waiting to get the promo code.  
I find it strange that I have to activate the SIM card first before anything works.  
Thanks alot. I will wait and activate first before trying. What we want to do is to build a tracking system for vehicles. We have already prototype with FIONA 808 from Adafruit with Raspberry 2 and now want to take the next step.

---

<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:** [July 30, 2016, 7:38pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/6 "2016-07-30T19:38:43Z")

</div>

In that case, you need to add `SYSTEM_MODE(MANUAL)` at the top of your sketch to have the code run without cloud connection.  
Additionally you can set `SYSTEM_THREAD(ENABLED)` which also allows for application code execution without connection.

---

<div class="post-metadata">

**Author:** ![rlingeh](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rlingeh/32/10895_2.png) [@rlingeh](https://community.particle.io/u/rlingeh)\
**Post date:** [July 30, 2016, 7:42pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/7 "2016-07-30T19:42:49Z")

</div>

WOW!! Thanks alot!  
I will add this two calls to the code example and try again.  
Thanks!

---

<div class="post-metadata">

**Author:** ![rlingeh](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rlingeh/32/10895_2.png) [@rlingeh](https://community.particle.io/u/rlingeh)\
**Post date:** [July 30, 2016, 8:16pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/8 "2016-07-30T20:16:19Z")

</div>

This is now my code

```cpp
SYSTEM_MODE(MANUAL)
SYSTEM_THREAD(ENABLED)

int led1 = D6; 
int led2 = D7; 

void setup() {
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);

}
void loop() {
  digitalWrite(led1, HIGH);
  digitalWrite(led2, HIGH);

  delay(1000);

  digitalWrite(led1, LOW);
  digitalWrite(led2, LOW);
  delay(1000);
}

```

So I have added the 2 system calls but still the LED doesn’t blink. The question I have is whether I have to delete the previous firmware in the Electron before flashing the new one. I flash always with  
particle flash --serial electron\_firmware\_1469908894745.bin. So each time I compile a version it’s generated containing the timestamp. So I am wondering if I have to delete the previous firmware first or it’s automatically overwritten.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [July 30, 2016, 9:08pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/9 "2016-07-30T21:08:27Z")

</div>

@rlingeh, the .bin filename changes on every compile so you may want to delete all the .bin files before you compile so you don’t lose track of the latest which you can flash over.

---

<div class="post-metadata">

**Author:** ![rlingeh](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rlingeh/32/10895_2.png) [@rlingeh](https://community.particle.io/u/rlingeh)\
**Post date:** [July 30, 2016, 9:26pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/10 "2016-07-30T21:26:11Z")

</div>

Thanks!  
On the computer I do delete the .bin files before compiling. But what I mean is the .bin file loaded in the Electron. Do I need to delete in the Electron before flashing the next one? Because I do not understand why my test example is not working at all.

Thanks

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [July 30, 2016, 10:15pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/11 "2016-07-30T22:15:32Z")

</div>

That gets overwritten when you flash a new one 😄

---

<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:** [July 31, 2016, 6:03am UTC](https://community.particle.io/t/blink-led-example-electron/24730/12 "2016-07-31T06:03:59Z")

</div>

As @Moors7 said, you just replace the firmware by flashing a new one.  
But if you are not sure whether your new code sticks or not, you could try flashing with

```nohighlight
particle flash --usb firmware.bin

```

in DFU Mode, which provides better feedback of errors (if any).

BTW: What does the RGB LED indicate now, when you run the above code? It should be breathing white.  
Does the onboard D7 LED do anything?

It might be that you are actually buildig for the wrong system firmware (currently default is 0.5.2) and the device would normally go into Safe Mode, but since the device is not connected to the cloud it can’t quite make it, so you’re stuck in limbo …

… unless you do (in Listening Mode - blinking blue)

```nohighlight
particle identify

```

to find out what system firmware you’ve got on the device and then build targeting your system like this

```nohighlight
particle compile electron . --target 0.4.8

```

where `0.4.8` is what I’d expect you got via `identify`

Or even better upgrade the Electron via DFU Mode (blinking yellow) and

```nohighlight
particle update

```

and then do a normal build via

```nohighlight
particle compile electron . -saveTo electron_firmware.bin

```

---

<div class="post-metadata">

**Author:** ![rlingeh](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rlingeh/32/10895_2.png) [@rlingeh](https://community.particle.io/u/rlingeh)\
**Post date:** [July 31, 2016, 4:31pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/13 "2016-07-31T16:31:48Z")

</div>

When I flash with "particle flash --serial firmware.bin", the D7 LED blinks once. The RGB LED changes from blinking blue (USB mode) to normally. I get a SUCCESS message.

But when I try "particle flash --usb firmware.bin", I keep getting this error message even when the RGB LED blinks yellow.

C:\Particle\>particle flash --usb firmware.bin  
!!! I was unable to detect any devices in DFU mode...

> Your device will blink yellow when in DFU mode.  
> If your device is not blinking yellow, please:

1. Press and hold both the RESET/RST and MODE/SETUP buttons simultaneously.
2. Release only the RESET/RST button while continuing to hold the MODE/SETUP button.
3. Release the MODE/SETUP button once the device begins to blink yellow.  
Error writing firmware...No DFU device found  
It appears to me as if something is fundamentally wrong. Here is the image when I try to flash using --usb.

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/8/89fa0d53e38f129e521a39cff8ecf5e00db369af.JPG)

---

<div class="post-metadata">

**Author:** ![rlingeh](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rlingeh/32/10895_2.png) [@rlingeh](https://community.particle.io/u/rlingeh)\
**Post date:** [July 31, 2016, 4:36pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/14 "2016-07-31T16:36:44Z")

</div>

particle identify shows version 0.4.8. So that could be the reason why I am not getting anything running. I will try as you have described here and see if I get my first “Getting Started” works.

---

<div class="post-metadata">

**Author:** ![rlingeh](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rlingeh/32/10895_2.png) [@rlingeh](https://community.particle.io/u/rlingeh)\
**Post date:** [July 31, 2016, 4:44pm UTC](https://community.particle.io/t/blink-led-example-electron/24730/15 "2016-07-31T16:44:12Z")

</div>

Woooooooow!! That hat been the problem. compiling with “particle compile electron . --target 0.4.8” works.  
So I have got it working now.  
Thanks!
