Hi everyone,
I have an Arduino MEGA 2560 connected to my laptop (USB 3.0) and when I use the Serial monitor it shows the output before the reset from the Serial monitor. After that, the monitor stays empty?
If I use the digitalSerial example I receive the data in the Serial monitor if I use this simple sketch:
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
int count;
int tries;
int minServo;
int maxServo;
void setup()
{
pinMode(A0, INPUT);
Serial.begin(9600);
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
for(pos = 45; pos < 135; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(25); // waits 15ms for the servo to reach the position
}
myservo.detach();
maxServo = analogRead(A0);
delay(1000);
myservo.attach(9);
for(pos = 135; pos>=45; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(25); // waits 15ms for the servo to reach the position
}
myservo.detach();
minServo = analogRead(A0);
delay(1000);
myservo.attach(9);
tries++;
if(minServo <= 188 && maxServo >= 333)
{
Serial.print("TEST SUCCEED: ");
count++;
Serial.print(count);
Serial.print("/");
Serial.println(tries);
Serial.print("MIN:");
Serial.println(minServo);
Serial.print("MAX:");
Serial.println(maxServo);
Serial.println("-------------------------");
}
}
I get a blank Serial monitor, it works fine when I use my desktop and the Arduino with this sketch.
Cheers,
Dylan