I am so sorry, i just got back from doing errands and realized that was the noobish thing i could have posted. Sorry and thanks.Here is the snippet that I changed.
void setup() {
// initialize Serial1 for ASCOM
Serial1.begin(9600);
analogWrite( Buzzer, 1023 );
// turn ON both LEDS as power on cycle indicator
analogWrite( bledIN, 1023 );
analogWrite( gledOUT, 1023 );
while(!Serial1); //ADDED BY RM
void loop() {
// process the command string when a hash arrives:
CheckSerialPort(); //ADDED BY RM
// Serial1Event occurs whenever new data comes in the Serial1 RX.
//void Serial1Event() {
// : starts the command, # ends the command, do not store these in the command buffer
// read the command until the terminating # character
//while (Serial1.available() && !eoc) {
//inChar = Serial1.read();
//if (inChar != '#' && inChar != ':') {
//line[idx++] = inChar;
//if (idx >= MAXCOMMAND) {
// idx = MAXCOMMAND - 1;
// }
// }
//else {
//if (inChar == '#') {
//analogWrite( gledOUT, 0 );
//eoc = 1;
//idx = 0;
// }
// }
// }
//}
void CheckSerialPort() {
while (Serial1.available() && !eoc) {
inChar = Serial1.read();
if (inChar != '#' && inChar != ':') {
line[idx++] = inChar;
if (idx >= MAXCOMMAND) {
idx = MAXCOMMAND - 1;
}
}
else {
if (inChar == '#') {
//analogWrite( gledOUT, 0 );
eoc = 1;
idx = 0;
}
}
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"I am using a Arduino micro instead of a nano and it seems that with the micro the Serialevent function is not working. This means Ascom can't get a connection to the arduino"
After some searching I found out that putting the function:
void serialEventRun(void) {
if (Serial.available()) serialEvent();
}
just before void setup() enables the serial communication.
Maybe fixed in next release of IDE.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Robert,
I am so sorry, i just got back from doing errands and realized that was the noobish thing i could have posted. Sorry and thanks.Here is the snippet that I changed.
void setup() {
// initialize Serial1 for ASCOM
Serial1.begin(9600);
analogWrite( Buzzer, 1023 );
// turn ON both LEDS as power on cycle indicator
analogWrite( bledIN, 1023 );
analogWrite( gledOUT, 1023 );
while(!Serial1); //ADDED BY RM
void loop() {
// process the command string when a hash arrives:
CheckSerialPort(); //ADDED BY RM
// Serial1Event occurs whenever new data comes in the Serial1 RX.
//void Serial1Event() {
// : starts the command, # ends the command, do not store these in the command buffer
// read the command until the terminating # character
//while (Serial1.available() && !eoc) {
//inChar = Serial1.read();
//if (inChar != '#' && inChar != ':') {
//line[idx++] = inChar;
//if (idx >= MAXCOMMAND) {
// idx = MAXCOMMAND - 1;
// }
// }
//else {
//if (inChar == '#') {
//analogWrite( gledOUT, 0 );
//eoc = 1;
//idx = 0;
// }
// }
// }
//}
void CheckSerialPort() {
while (Serial1.available() && !eoc) {
inChar = Serial1.read();
if (inChar != '#' && inChar != ':') {
line[idx++] = inChar;
if (idx >= MAXCOMMAND) {
idx = MAXCOMMAND - 1;
}
}
else {
if (inChar == '#') {
//analogWrite( gledOUT, 0 );
eoc = 1;
idx = 0;
}
}
}
}
Concerning the Micro
"I am using a Arduino micro instead of a nano and it seems that with the micro the Serialevent function is not working. This means Ascom can't get a connection to the arduino"
After some searching I found out that putting the function:
void serialEventRun(void) {
if (Serial.available()) serialEvent();
}
just before void setup() enables the serial communication.
Maybe fixed in next release of IDE.