its vary odd ... wanted some Input on this ...
Every other time i open the serial monitor it locks up and no response close it hit the arduino ide lil serial monitor button and it works this time ..
5 mins later locks up sitting idle .
close it.
open it window opens blank white serial monitor with normal input line type in a letter for a response
i get nothing .
when it opens it should message the first print line every other time it does .. every other time it does not ?????
when i do get my opening message of port test it works for a few mins responding with serial prints from my case code then quits unexpectedly and has to be reopened twice to get a n input response again.
what the heck i'm on the most recent ide 1.89
below is the code im running on a arduino r3 uno from arduino legit board not a copy
#include <Servo.h>
const int ledPin = 13;
int pulse = 12;
int dir = 11;
int t1 = A1;
int t2 = A2;
Servo myservo1; // create servo
Servo myservo2; // create servo
//HX711 scale2(7, 8);
//stepper intagers
int acel = 900;
int dcel = 500;
int temp1 = 0;
int temp2 = 0;
int m1 = 0;
int m2 = 0;
String stringOne = "";
int j1 = 0;// jog wheel enable
// saw ints
int RPM = 0;
int DM = 0;
int incomingByte;
int x1 = 0;
int a1 = 0;
int b2 = 0;
int count = 0;
int diff = 0;
int analogValue;
//encoder intagers
//Electrical stats ints
int AMPLOAD = A0;
int ledPinST = 0;
int tempdspeed = 0;
// communacations value stores
String inString = "";
float gotoByte = 0;
float gotoabs = 0;
long tempsteps = 0;
long steps = 0;
long xspeed = 700;
long tempxspeed = 700;
long aspeed = 1200;
long dspeed = 1500;
byte estop;
int checkindex = 0;
byte inByte;
void setup() {
Serial.begin (9600);
checkindex = 1;
pinMode(ledPin, OUTPUT);
pinMode (dir, OUTPUT);
pinMode (12, OUTPUT);
pinMode (4, OUTPUT);
pinMode (5, OUTPUT);
pinMode (6, OUTPUT);
pinMode (AMPLOAD, INPUT);
myservo1.attach(2);
myservo2.attach(3);
m1 = 92;
m2 = 92;
temp1 = 92;
temp2 = 92;
delay(50);
Serial.begin(9600);
while (!Serial) {
// wait for serial port to connect. Needed for native USB port only
}
delay(2);
Serial.println("serial port test");
Serial.println("Responding");
}
void loop() {
if (j1 == 1) {
jogwheel();
Serial.println("k");
}
if (Serial.available()) {
inByte = Serial.read(); // read the byte
inString = inByte;
Serial.println(inString); // send what you got
switch (inByte) {// do stuff with byte
case 'a':// SETTING ACCELERATION FROM REMOTE SERIAL
aspeed = Serial.parseInt();
Serial.println("k");
break;
case 'c':// CLEAR ALL STORED VALUES AND REST TO ZERO
Serial.println("k");
break;
case 'g':// SETTING STEPS FROM REMOTE SERIAL
gotoByte = Serial.parseFloat();
Serial.println("k");
break;
case 's':// SET THE DECEL SPEED VIA REMOTE SERIAL
dspeed = Serial.parseInt();
dcel = dspeed;
tempdspeed = dcel;
Serial.println("k");
break;
case 'f':
xspeed = Serial.parseFloat();
tempxspeed = xspeed;
break;
case 'k':// debugging print all var to serial monitor
Serial.println("k");
Serial.println("Port2 Active");
Serial.println("Port2 sending all variables");
Serial.print("Port2 LED State =");
Serial.println(ledPin);
Serial.print("Port2 pulse State =");
Serial.println(pulse);
Serial.print("Port2 Dir State =");
Serial.println(dir);
Serial.print(" Port2 t1 = ");
Serial.println(t1);
Serial.print(" Port2 t2 = ");
Serial.println(t2);
Serial.print(" Port2 Acel setting = ");
Serial.println(acel);
Serial.print(" Port2 Decel setting = ");
Serial.println(dcel);
Serial.print(" Port2 temp var is = ");
Serial.println(temp1);
Serial.print(" Port2 temp2 var is ");
Serial.println(temp2);
Serial.print(" Port2 m1 = ");
Serial.println(m1);
Serial.print(" Port2 m2 = ");
Serial.println(m2);
Serial.print(" Port2 string 1 = ");
Serial.println(stringOne);
Serial.print(" Port2 j1 = ");
Serial.println(j1);
Serial.print(" Port2 rpm = ");// jog wheel enable
Serial.println(RPM);
Serial.print(" Port2 Dm = ");
Serial.println(DM);
Serial.print(" Port2 INcoming byte = ");
Serial.println( incomingByte);
Serial.print(" Port2 X1 = ");
Serial.println(x1);
Serial.print(" Port2 a1 = ");
Serial.println(a1);
Serial.print(" Port2 b2 = ");
Serial.println(b2);
Serial.print(" Port2 count = ");
Serial.println(count);
Serial.print(" Port2 diff = ");
Serial.print(" Port2 ledpinst =");
Serial.println(ledPinST);
Serial.print(" Port2 temp speed = ");
Serial.println(tempdspeed);
Serial.print(" Port2 inbyte = ");
Serial.println(inByte);
Serial.print(" Port2 in string = ");// incoming serial byte
Serial.println(inString);
Serial.print(" Port2 gotobyte = ");
Serial.println( gotoByte);
Serial.print(" Port2 gotoabs = ");
Serial.println( gotoabs);
Serial.print(" Port2 temp step =");
Serial.println( tempsteps);
Serial.print(" Port2 step =");
Serial.println( steps);
Serial.print(" Port2 xspeed = ");
Serial.println( xspeed);
Serial.print(" Port2 temp x speed = ");
Serial.println(tempxspeed);
Serial.print(" Port2 a speed = ");
Serial.println(aspeed);
Serial.print(" Port2 d speed = ");
Serial.println(dspeed);
Serial.print(" Port2 z2 speed = ");
Serial.print(" Port2 estop = ");
Serial.println(estop);
Serial.print(" Port2 check index = ");
Serial.println(checkindex);
Serial.println("Send all Compleat");
break;
case 'X':
myservo1.write(m1);
myservo2.write(m2);
Serial.print(" All motor stop");
steps = 0;
DM = 0;
m1 = 92;
m2 = 92;
myservo1.write(m1);
myservo2.write(m2);
break;
case 'Z':// more serial Debugging
if (ledPinST == 0) {
// turn LED on:
ledPinST = 1;
digitalWrite(ledPin, HIGH);
}
else
{
ledPinST = 0;
digitalWrite(ledPin, LOW);
}
break;
}
}
}
void motors() {
}
void checkload() {
a1 = x1;
}
void jogwheel() {
Serial.println("k");
}
void jogup() {
Serial.println("k");
}
void jogdown() {
Serial.println("k");
}