Ultrasonic sensor test will not work


#1

Downloaded libraries.
Used example sketch: TestUltrasonicsensor
Uploaded; MeBlock is correct port on pc; changed sketch to port 6 as I ported sonic to port 6.

Sketch Never stops downloading.
No results; solid lights on board, sensor and digital display(port5); can hear faint buzz from sensor.

Help!

Thanks,
Joe


#2

Joe,

Can you upload a copy of your code example, so I can test it on my setup?

I’ll let you know how my results work out.

Mike


#3

/*************************************************************************

  • File Name : TestUltrasonicSensor.ino
  • Author : Steve
  • Updated : Steve
  • Version : V1.0.0
  • Date : 2/22/2013
  • Description : Test for Makeblock Electronic modules of Me -
    Ultrasonic Sensor. The module can ONLY be connected
    to the PORT_3, PORT_4, PORT_5, PORT_6, PORT_7,
    PORT_8 of Me - Base Shield.
  • License : CC-BY-SA 3.0
  • Copyright © 2013 Maker Works Technology Co., Ltd. All right reserved.
  • http://www.makeblock.cc/
    **************************************************************************/
    #include <Makeblock.h>
    #include <Arduino.h>
    #include <SoftwareSerial.h>
    #include <Wire.h>

MeUltrasonicSensor ultraSensor(PORT_6); //Ultrasonic module can ONLY be connected to port 3, 4, 6, 7, 8 of base shield.

void setup()
{
Serial.begin(9600);

}

void loop()
{
Serial.print(“Distance : “);
Serial.print(ultraSensor.distanceCm());
Serial.println(” cm”);
delay(100);// the minimal measure interval is 100 milliseconds
}


#4

The bold “includes” = #include libraries…;that seems to work.
Those did not paste as cut.

Thanks again.
I am using the test example; what could go wrong? My first attempt at Arduino.


#5

to paste code highlight the code and use the </> symbol at the top edge of the forum editor to preserve formatting

#include blah


#6

Tried it. Same result. looks right before I post; has the big bold “include” after I post.


#7

Joe,

Have you tried other “demo” code? What were the results? I’m trying to isolate the problem to the Ultrasonic, MeBlock, or comm settings on your computer.

Mike


#8

Mike,
This was my first attempt out of the box.
I found the uploading problem. Now sketch uploads. I did all three examples for the digital readout. All were successful.
When I upload the us sensor sketch , I get a fast blink on the board next to the 9v power input, but no readout. In fact the display froze with the numbers for its test just prior to the us sensor test. (I did move the us sensor to test for results)
I tried a temp sensor I have with the same result.

My pc, running win 10, recognizes the board and I set the COM port as indicated.

The sketch does not require an output port number for the results, just ‘serial’. I guess it knows if there is a display connected and to which port it is connected. The example sketch for the dig display assigned a port number.

Thank you for your help,
Joe


#9

Tried a different program. It worked. It designated a port for the display.

All is good.
Thanks.


#10

Joe

If there is no designated output, but there are Serial.print commands, try this:

In the Arduino IDE, Select ‘Tools’, then ‘Serial Monitor’.

This will pop up a new window which displays the output. Make sure that the baud rate is set the same for both the program and the monitor.

See if that works.

Mike


#11