# Electron taking over computer screen

**URL:** <https://community.particle.io/t/electron-taking-over-computer-screen/42648>\
**Category:** Troubleshooting\
**Created:** [June 22, 2018, 6:03pm UTC](https://community.particle.io/t/electron-taking-over-computer-screen/42648 "2018-06-22T18:03:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iras](https://avatars.discourse-cdn.com/v4/letter/i/aca169/32.png) [@Iras](https://community.particle.io/u/Iras)\
**Post date:** [June 22, 2018, 6:03pm UTC](https://community.particle.io/t/electron-taking-over-computer-screen/42648/1 "2018-06-22T18:03:33Z")

</div>

I somehow got the Electron into a state where anytime it is connected to a computer (Windows), it takes over the mouse.

I was able to put it into DFU mode and re-flash firmware v0.7.0, But as soon as I connect it via USB to a computer, it acts like a rogue mouse - cursor moves around on the screen, randomly right clicks, etc.

With the firmware re-flashed (but the device not connected to a computer), it can do an OTA flash of user code. I’ve even re-flashed v0.7.0 more than once - same problem.

But any time I connect this to a computer (I’ve tried more than one), it takes over mouse functions randomly.

How can I get this corrected?

---

<div class="post-metadata">

**Author:** ![ninjatill](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ninjatill/32/17370_2.png) [@ninjatill](https://community.particle.io/u/ninjatill)\
**Post date:** [June 22, 2018, 6:08pm UTC](https://community.particle.io/t/electron-taking-over-computer-screen/42648/2 "2018-06-22T18:08:20Z")

</div>

Have you tried to re-flash the default tinker app? I would start with flashing tinker to rule out the device hardware having an issue.

If you can post the user code that is causing the rogue behavior, maybe we can pinpoint the issue.

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [June 22, 2018, 6:09pm UTC](https://community.particle.io/t/electron-taking-over-computer-screen/42648/3 "2018-06-22T18:09:13Z")

</div>

This is a Windows problem--the solution is here:

> [@Issues using serial debugging (Mouse moving)](https://community.particle.io/t/issues-using-serial-debugging-mouse-moving/1200/9):
>
> In terms of weird interactions / bugs, that’s pretty wild! slight_smile This name “Microsoft Serial Ballpoint” is magic, because searching for that shows a lot of people having this same problem with USB serial devices: The fix for this appears to be to disable Window’s support for crazy Serial mice entirely ##Warning! This fix involves editing your registry, make a restore point first! ###I have wrecked machines by goofing up a registry edit, you should really make a restore point first. …

---

<div class="post-metadata">

**Author:** ![Iras](https://avatars.discourse-cdn.com/v4/letter/i/aca169/32.png) [@Iras](https://community.particle.io/u/Iras)\
**Post date:** [June 22, 2018, 10:42pm UTC](https://community.particle.io/t/electron-taking-over-computer-screen/42648/4 "2018-06-22T22:42:18Z")

</div>

> [@ninjatill](#):
>
> Have you tried to re-flash the default tinker app? I would start with flashing tinker to rule out the device hardware having an issue.
> 
> If you can post the user code that is causing the rogue behavior, maybe we can pinpoint the issue.

If I flash my "real" project code, all is well. But I've been trying to resolve a problem with a GPS module (separate thread) and I've been playing with the TinyGPS example code, pruning it down and tuning it to see whether I'm dealing with a software issue or something related to RF interference or power noise.

The pruned down code that reliably makes the mouse go wild is:

```cpp
// This #include statement was automatically added by the Spark IDE.
    #include "TinyGPS.h"

    #include "Serial5/Serial5.h"

    SYSTEM_THREAD(ENABLED);

    TinyGPS gps;
    char szInfo[64];
    long lastsleep = 0; 

    void setup() {
      Serial5.begin(9600);
      Serial.begin(9600);
      Serial.println("Starting");
    }

    void loop(){

        bool isValidGPS = false;
        while (Serial5.available()){
            char c = Serial5.read();
            Serial.print(c);
            if (gps.encode(c))
               isValidGPS = true;
        }
        if (isValidGPS){
            float lat, lon;
            unsigned long age;
    
            gps.f_get_position(&lat, &lon, &age);
        
            sprintf(szInfo, "%.6f,%.6f", (lat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : lat), (lon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : lon));
            Serial.println(szInfo);
        }
        else {
            if (millis() > lastsleep) {
                lastsleep = millis() + 2000;
                Serial.println("No fix");
            }
        }
     }

```

I've also tried eliminating the sprinf and replacing it with just plain Serial.print statements - no difference.

---

<div class="post-metadata">

**Author:** ![Viscacha](https://avatars.discourse-cdn.com/v4/letter/v/919ad9/32.png) [@Viscacha](https://community.particle.io/u/Viscacha)\
**Post date:** [June 22, 2018, 11:33pm UTC](https://community.particle.io/t/electron-taking-over-computer-screen/42648/5 "2018-06-22T23:33:31Z")

</div>

@bko has shown you the answer

---

<div class="post-metadata">

**Author:** ![ninjatill](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ninjatill/32/17370_2.png) [@ninjatill](https://community.particle.io/u/ninjatill)\
**Post date:** [June 24, 2018, 1:53am UTC](https://community.particle.io/t/electron-taking-over-computer-screen/42648/6 "2018-06-24T01:53:31Z")

</div>

The issue @bko pointed out was unknown to me. I read that post and it seems that is the issue you are running into. There is probably a character sequence in the data you are outputting to serial that is triggering the mouse movement. I would do what that post suggests and disable serial mice via the registry.
