Hello everyone has anyone an answer for this problem. If I do a Serial.begin I receive some strange data from the Arduino Dew.
here is a copy of the code
//**************************************************//
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial.available() !=0 ){Serial.print("E");}
}
//****************************************************//
this is what I get back: EEEEEEEEEEEEEEEEEEEÅ
since the program makes no attempt to send code unless data was available to it. it seems that somehow the Serial.begin is outputting some data at start up . Any one see this or know what's happening.
jimbod:
Hello everyone has anyone an answer for this problem. If I do a Serial.begin I receive some strange data from the Arduino Dew.
here is a copy of the code
//**************************************************//
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial.available() !=0 ){Serial.print("E");}
}
//****************************************************//
this is what I get back: EEEEEEEEEEEEEEEEEEEÅ
since the program makes no attempt to send code unless data was available to it. it seems that somehow the Serial.begin is outputting some data at start up . Any one see this or know what's happening.
Kawgomoo:
lol sorry i actually read the code after i said that…….
…isn't he telling it to print an E? Yes, and in an endless fashion.
{just trying to understand all this, thinking out loud. feel free to ignore the new kid!}
I really believe beginners would benefit knowing how BASIC program execution works in ANY computer, what is the purpose of main() or its derivatives and how main() is implemented in Arduino sketch.
This all comes from BareMinimum example, with really minimum description. A simple link to Arduino main() source code would be nice to include. People should not be treated as idiots unable to comprehend "real" code besides blinking LED.
That some folks just cannot read is a different issue, been guilty myself doing same few times.
In the mean time Arduino site will unnecessarily challenge beginners this silly way, but it generates traffic here!
And the bean counters are happy!
off my soup box - its getting late here
First of all I am not a beginner as that person, who can't read code said. I have programed microprocessors and controllers Since the first 4 bit unit was built by intel. It is true that I am unfamiliar with the arduino , but the code is correct. yes it is in going to print an E every time a byte is received I am using the serial monitor but i am not sending any data across so I should never see any E's but when the serial monitor is opened sometimes I see about 10 E's which tells me that the serial monitor sent 10 bytes of data. This should not happen since no data has been typed in. So it seems that something in the hand shaking my be at fault. The reason I used E instead of the byte received is the byte received is not a displayable character so the E help me determine the number of characters sent.. this code is just for diagnostics and nothing more.
I tried your code on my Uno and it did not produce any Es when I started it or reset it.
However as soon as I typed a letter in the Serial monitor it ran away with itself printing Es. Obviously that happened because there is no code to empty the input buffer.
It would probably be useful to put some code in setup() to ensure the input buffer is empty and some extra code in loop() to slow the rate of producing Es.
Thanks for running the code for me, I did that in another program with the same effect. you help me and I think there could be a hardware problem with my Arduino.
With the code as shown, the sketch will start printing EEEEEE continuously after the first character is received on the serial, because while you CHECK serial.available(), you don't actually READ the available character, and it will STAY available until you do.
Once you have an Arduino spewing data at your PC, some of that data will get buffered in various places, and it's pretty common to see some of that data when you start the serial monitor. For example, if I run the "AsciiTable" example, and open and close the Serial monitor, I see some "stuttering" at the beginning:
YES your are correct however the purpose diagnostic was not for you to enter any key but to show that in my arduino when the serial monitor is opened the arduino sees data available when nothing ha been sent. the condition is intermittent. another member ran the code on his dew and got no characters until a key was pressed which points to something wrong with my Due.
jimbod:
First of all I am not a beginner as that person, who can't read code said. I have programed microprocessors and controllers Since the first 4 bit unit was built by intel. It is true that I am unfamiliar with the arduino , but the code is correct. yes it is in going to print an E every time a byte is received I am using the serial monitor but i am not sending any data across so I should never see any E's but when the serial monitor is opened sometimes I see about 10 E's which tells me that the serial monitor sent 10 bytes of data. This should not happen since no data has been typed in. So it seems that something in the hand shaking my be at fault. The reason I used E instead of the byte received is the byte received is not a displayable character so the E help me determine the number of characters sent.. this code is just for diagnostics and nothing more.
Dear friend, under normal condition I would just ignore your remarks, but since you seems to be offended by “that person” - I do have a name – here is my reply. First of all, I do apologize for my “beginner' remarks, it was OT.
I should have just said
If ( you do understand the function loop() in your sketch , cut and copied directly from Examples BareMinimum even with the “runs forever” comments(!) )
and ( you understand what Serial.avaialable does )
and when if( ) evaluates to true
than you should not be posting this as “Comport problem”.
It would help if to evaluate your posted code to see if that is what you want to accomplish.
Inherently , there is nothing wrong with writing verification code like you did, but you did not carry it far enough and posted the issue as “Comport problem”.
And since you are not a beginner, you know that external devices / hardware are not always set it known state on initialization / power up. Of course there are things like noise, which I am sure you are well aware of too.
PS Just noted this – no comments
The reason I used E instead of the byte received is the byte received is not a displayable character so the E help me determine the number of characters sent..