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.