Im a very beginner with Arduino. Recently started with the blink code. Thats my only experience with these. Ive got an ultrasonic sensor (As in this tutorial http://howtomechatronics.com/tutorials/arduino/ultrasonic-sensor-hc-sr04/). So I setup the connections as trigger to Pin3 , Echo to 4, Vcc to 5v marked pin, GND to gnd next to 5v. Im using Arduino nano clone. When I run the program same as in the above example Im getting the following error. Other than that Im not getting any information.

enter image description here

Im sharing the same program I tried.

// defines pins numbers
const int trigPin = 3;
const int echoPin = 4;
// defines variables
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
void loop() {
// Clears the trigPin
digitalWrite(trigPin, LOW);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
  • 2
    Where are you getting that error? That's not like any Arduino error I have ever seen. – Majenko Aug 13 '17 at 13:29
  • I'm doing the code in Arduino web editor. I saw the above message in web console of the Arduino editor – Sandeep Thomas Aug 13 '17 at 14:34
  • 2
    That doesn't look like an error message - "level=info". I've never used the web editor but this page says you need to open the sidebar to see the serial monitor. Did you do that? – Johnny Mopp Aug 13 '17 at 15:02
  • 1
    @JohnnyMopp Thanks a lot for that. I was using wrong console window. I was using the plugin console instead of the web console by mistake. Thanks a lot for guiding the correct way – Sandeep Thomas Aug 13 '17 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.