Serial monitor does not work continuously.

EDIT3: Problem seems to be caused by PulseIN, as NewPing library does not show the same issue.
torrent turned irrelevant with this “discontinuity” problem, although It was relevant with everything else.I also suggest using smaller unknowns units to send, and better save ome part of the data before serial communicatting, to serial not interfere with the process.

Yes, that is the problem.
More spesifically, my antivirüs program damaged some of the programs while I was trying to install a program from torrents. ( At least that’s what I think so.)
One of the programs were Yandex BROWSER. I am even unable to install it again even after I uninstalled it.

The other one I know damaged is Arduino 1,6,8. It was unable to upload any code.
I uninstalled it and installed 1,8,1.

Now, some of my old codes work differently. Serial monitor stops working for occasionally, even on very simple codes.

For example, this basic HC-SR04 reading code

#include <NewPing.h>


#define echoPin 9
#define trigPin 10
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(115200);
}


long mesafe()
{
  long duration, distance;
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration=pulseIn(echoPin, HIGH);
  distance=duration/58.2;
  //delay(25);
  return distance;
  
  }
void loop() {
int olcum=mesafe();
//if(olcum<200)
//{
  Serial.println(olcum);
//}
//delay(50);}

}

When I check RX LED on my Arduino UNO, It was continuously on, or constantly blinking, based on data speed. Now, It randomly goes off.

Until this point, this problem occurs only with modules, not between 2 arduinos.
I tried this code on 2 arduinos connected and it works continuously even when I disturb it by writing something on it.

#include <SoftwareSerial.h>
SoftwareSerial a(5, 6);
void setup() {
Serial.begin(9600);
a.begin(9600);

}
int sayac;
int k;
void loop() {
if(a.available())
{k=a.read();
Serial.println(k);}
a.println(sayac);
sayac++;
if(Serial.available())
{k=Serial.read();
a.println(k);
  }
}

I can exemplify further If necessary.

I am open to any idea.
Thanks…

EDIT: Wire library(12C) faces exact the same problem.

EDIT2: I uploaded Arduino 1,6,8 and 1,6,9 to try again.
The error report:

Arduino:1.6.9 (Windows 10), Kart:"Arduino/Genuino Uno"

Exception 0xc0000090 0x0 0x0 0x102842
PC=0x102842

syscall.Syscall12(0x769fe320, 0xa, 0x126dd130, 0x12726500, 0x0, 0x0, 0x1, 0x400, 0x12768000, 0x0, ...)
 C:/Go1.5/src/runtime/syscall_windows.go:161 +0x4a
syscall.CreateProcess(0x126dd130, 0x12726500, 0x0, 0x0, 0x1, 0x400, 0x12768000, 0x0, 0x124c36f8, 0x124c36a4, ...)
 C:/Go1.5/src/syscall/zsyscall_windows.go:580 +0xba
syscall.StartProcess(0x12721740, 0x54, 0x126a5a00, 0x19, 0x1a, 0x124c37b0, 0x0, 0x0, 0x0, 0x0)
 C:/Go1.5/src/syscall/exec_windows.go:326 +0x752
os.startProcess(0x12721740, 0x54, 0x126a5a00, 0x19, 0x1a, 0x124c38dc, 0x1271a700, 0x0, 0x0)
 C:/Go1.5/src/os/exec_posix.go:45 +0x2c8
os.StartProcess(0x12721740, 0x54, 0x126a5a00, 0x19, 0x1a, 0x124c38dc, 0x0, 0x0, 0x0)
 C:/Go1.5/src/os/doc.go:24 +0x53
os/exec.(*Cmd).Start(0x126d2e60, 0x0, 0x0)
 C:/Go1.5/src/os/exec/exec.go:328 +0x6da
os/exec.(*Cmd).Run(0x126d2e60, 0x0, 0x0)
 C:/Go1.5/src/os/exec/exec.go:255 +0x2b
arduino.cc/builder/builder_utils.ExecRecipeCollectStdErr(0x1271f1c0, 0x5bc3c0, 0x15, 0x1, 0x325d43e8, 0x692034, 0x0, 0x0, 0x0, 0x0)
 c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/builder_utils/utils.go:340 +0x129
arduino.cc/builder.(*GCCPreprocRunnerForDiscoveringIncludes).Run(0x12722380, 0x124f2000, 0x0, 0x0)
 c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/gcc_preproc_runner.go:91 +0x243
arduino.cc/builder.runCommand(0x124f2000, 0x325d8bb0, 0x12722380, 0x0, 0x0)
 c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/container_find_includes.go:94 +0x57
arduino.cc/builder.findIncludesUntilDone(0x124f2000, 0x1271d030, 0x67, 0x0, 0x0)
 c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/container_find_includes.go:112 +0x2a4
arduino.cc/builder.(*ContainerFindIncludes).Run(0x692034, 0x124f2000, 0x0, 0x0)
 c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/container_find_includes.go:50 +0x227
arduino.cc/builder.runCommands(0x124f2000, 0x124c3cfc, 0x1c, 0x1c, 0x1, 0x0, 0x0)
 c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/builder.go:181 +0xe2
arduino.cc/builder.(*Builder).Run(0x124c3df0, 0x124f2000, 0x0, 0x0)
 c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/builder.go:116 +0xb53
arduino.cc/builder.RunBuilder(0x124f2000, 0x0, 0x0)
 c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/builder.go:212 +0x35
main.main()
 c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/arduino-builder/main.go:316 +0x152c
eax     0x0
ebx     0x32e67008
ecx     0x0
edx     0x32e00000
edi     0x3434
esi     0x32e67000
ebp     0xdf6d4
esp     0xdf6ac
eip     0x102842
eflags  0x10216
cs      0x23
fs      0x53
gs      0x2b
arduino-builder, 2'i döndürdü
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Using torrent downloaded programs is a bad idea unless you know exactly what you are doing and the effect they can have on a computer.

That said your AV kicked into gear but sounds like it may have been either over zealous or compromised.
In such instances it is always best to double check the computer BEFORE doing anything else.

There are quite a few steps to ensure the computer is safe to use again.
First off DONT trust your current AV at the moment.

  1. Go HERE and run ESET online scanner until it is completely done don’t stop it and let it clean up ANYTHING it finds even if its something you wanted. Dont do the download use the online scanner “SCAN NOW” option.

  2. Now go HERE and run that scanner too but NOT AT THE SAME TIME AS THE ONE ABOVE !!

  3. If they both turned up clean (which I doubt) then go HERE and take the FREE download. Install and RUN it then select SCAN and use the “THREAT SCAN” until the end and let it clean anything else it finds.

  4. If at this point the computer becomes unusable you had a major virus and will have to do a total fresh install of the OS from known safe media.

  5. If you got this far you should be pretty clean but you are not out of the woods yet.

  6. Go HERE and download CLEANER install and run just the cleaner section nothing else “Analyse” then when it has done that select "RUN CLEANER on the lower right and let it do its thing.

  7. Almost there just a couple more steps. Go HERE download and install. Run it and select DEEP SCAN and when its done that select CLEAN. Its up to you if you want to back up but in view of what you said I would not do that at this time as you could just be backing up remnants of a nasty.

  8. Double check that your own AV runs and performs as expected by doing a full scan and if you notice any issues uninstall and clean it out and install a fresh clean copy. But go to step 1. again after you uninstall !!!

If your computer is still usable (should be) then you would want to MOVE your sketches folder somewhere safe FIRST !!
Now UNINSTALL the IDE completely and run a FRESH installation however you should do a clean up with both CCLEANER and WISE after the uninstall and BEFORE re-installing the IDE.

There is a folder you will want to delete and its probably one of the following locations. If you cant find it then you need to enable “Show Hidden Folders” full clean up instructions attached below.

CLEAN UP BEFORE INSTALLING ANOTHER COPY OF THE IDE OR ARDUINO CREATE.pdf (345 KB)

I am giving it a try.

I realise that what I gave you is quite a lot of work in regards to time.

But honestly better safe than sorry.

I used to go out and service computers ( domestic and commercial) and roll out for large companies so I dont take security lightly and took the time to give you the best answer based on most of the steps I would take.

Naturally I have some other methods but they rely on USB bootkeys loaded up with things I would need in the field to speed things up.

9 hours passed I started the first step. It hasn't been completed. Lost connection for a moment. Hope it works from where it lost connection. Almost %95 complete 407078 files scanned until now. 10 files infected.

I have no idea what to say :O

Bought an external memory, considering saving some important files, after dealing with viruses.. Haven't opened the box yet..

Good idea to leave the box unopened until after everything else is dealt with.

The online stuff does take a lot longer but at least you know its being done properly without using possibly corrupted antivirus.

Take your time its worth it. Try not to use that computer for much else online especially games etc as that will slow it down too.

I completed first 2 steps and restarted the computer. Arduino 1,6,8 compiles and I successfully installed Yandex BROWSER again.

Everything seems working now, but I will try making codes working tomorrow. It's 02:47 am here.

Thank you man, THANK YOU!

Whoa there....

You still have 6 steps to go but honestly they are the easier ones and quicker too.

Dont play too much until you finish the full course of treatment the doctor said LOL.

Continuing from the third step

OK... I wont be around till much later today will try catch up.

Well, In total, scans catched about 60 threads. I am on 7. step. There is more than 50.000 double file, so I am unable to choose every single item. And I don't see any "clean" button, only "delete"

BTW, I am unable to exert 8. step. I had to delete the first Antivirus

Step 7 is the WISE reg cleaner.

The FREE one. You should have chosen DEEP SCAN and the option at the end of the scan is CLEAN.

Double checked here JIC there was an update I may have missed.

BTW when you have run WISE REG CLEANER do a restart. And dont blame me if your computer seems a little faster.

Also noticed I lost a link on the post to CCLEANER let me fix that.

EDIT

As far as step 8 goes avoid Norton and Mcafee at all costs. They used to be one of the best back in the old days but are mostly bloatware now and to be honest a lot of the FREE ones such as AVG or AVAST will cover most needs so long as you use them properly.

Sorry, I downloaded the wrong progra(wise duplicate finder). Now It's correct. I understood CCleaner, used the link on the file.

Arduino serial seems working fine.

I found out the problem about serial monitor is due to one of my transmitter's battery was low.

So, all of those are irrelevant with Serial monitor problem, a different problem about Arduino's old version not being able to upload the code.

Two distinct problems... The main problem seems irrelevant with every other thing I wrote at the topic text. What I did following your instructionc fixed browser problem and deleted viruses though.

I will further check to confirm it.

Ha ha.. Well one good thing you know you're computer is clean and good to go !

Glad you got top the bottom of it. I know i have looked in the wrong place for faults in the past too but thats how we learn.

My checks disconfirmed my theory. Problem still exists. Now I tried to use something different than PulseIn. The only thing I haven't changed. NewPing library seems solving thee problem, but this also need to be checked.

Other than that, I enjoy my clean computer. :) Although I still need that program I tried to upload I will think of something later