# OpenMV R2 does not execute code without a USB cable

**URL:** <https://forums.openmv.io/t/openmv-r2-does-not-execute-code-without-a-usb-cable/6826>\
**Category:** OpenMV Boards\
**Created:** [February 11, 2022, 12:20pm UTC](https://forums.openmv.io/t/openmv-r2-does-not-execute-code-without-a-usb-cable/6826 "2022-02-11T12:20:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexS](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@AlexS](https://forums.openmv.io/u/AlexS)\
**Post date:** [February 11, 2022, 12:20pm UTC](https://forums.openmv.io/t/openmv-r2-does-not-execute-code-without-a-usb-cable/6826/1 "2022-02-11T12:20:52Z")

</div>

Hi,  
I am using an OpenMV R2 that is connected to an external battery source.  
I implemented this simple code to light up the red LED on the R2:

```auto
from pyb import LED

led = LED(2) # red led

while(True):
    led.on()

```

The program executes without a problem if I keep connecting the USB cable from my laptop to the camera. When I disconnect the OpenMV from the USB cable (so it is now power-less) and connect the external battery to power up the OpenMV without the USB cable, the OpenMV just blinks blue (not red, as I originally programmed it). How can I fix this problem, and what does this blue blinking mean?  
Thank you very much.

---

<div class="post-metadata">

**Author:** ![oramafanis](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/oramafanis/32/1783_2.png) [@oramafanis](https://forums.openmv.io/u/oramafanis)\
**Post date:** [February 11, 2022, 12:45pm UTC](https://forums.openmv.io/t/openmv-r2-does-not-execute-code-without-a-usb-cable/6826/2 "2022-02-11T12:45:23Z")

</div>

> [@AlexS](#):
>
> am executes without a problem if I keep connecting the USB cable from my laptop to the camera. When I disconnect the OpenMV from the USB cable (so it is now power-less) and connect the external battery to power up the OpenMV without the USB cable, the OpenMV just blinks blue (not red, as I originally programmed it). How can I fix this problem, and what does this blue blinking mean?  
> Thank you very much.

Did you saved the main.py to the camera?

---

<div class="post-metadata">

**Author:** ![AlexS](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@AlexS](https://forums.openmv.io/u/AlexS)\
**Post date:** [February 11, 2022, 1:23pm UTC](https://forums.openmv.io/t/openmv-r2-does-not-execute-code-without-a-usb-cable/6826/3 "2022-02-11T13:23:25Z")

</div>

Hi, thanks for your reply.  
No I did not. How can I do that?

---

<div class="post-metadata">

**Author:** ![oramafanis](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/oramafanis/32/1783_2.png) [@oramafanis](https://forums.openmv.io/u/oramafanis)\
**Post date:** [February 11, 2022, 2:50pm UTC](https://forums.openmv.io/t/openmv-r2-does-not-execute-code-without-a-usb-cable/6826/4 "2022-02-11T14:50:58Z")

</div>

file-\> save as-\> select your camera storage and save as main.py .  
you have to replace the existing main .py

---

<div class="post-metadata">

**Author:** ![AlexS](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@AlexS](https://forums.openmv.io/u/AlexS)\
**Post date:** [February 11, 2022, 2:55pm UTC](https://forums.openmv.io/t/openmv-r2-does-not-execute-code-without-a-usb-cable/6826/5 "2022-02-11T14:55:27Z")

</div>

Thank you！ It worked.
