4. Ultrasonic sensor

In this example, you will learn to visualize the distance on web, measured using ultrasonic sensor.


- Get an Arduino board, ultrasonic sensor and few jumpers
- Connect Echo and Trigger pins of ultrasonic sensor at digital pin #11 and #12, respectively
- Also connect the power and ground pins of ultrasonic sensor
- Connect Arduino board with computer

swDuino ultrasonic sensor example


- Open Arduino IDE
- Install swDuino Arduino library (if not yet installed)
- Open example: Files > Examples > swDuino-Lib > ultrasonic_sensor sketch.
- Upload it to Arduino board.


- Open swDuino
- Configure Serial/COM and HTTP/Web server (optional)
- Start swDuino Server

Web browser

- Open web browser
- Browse this page: http://[server]:[port]/files/examples/ultrasonicsensor.html (click here if you have used the default configuration for HTTP/Web server)
- Go to Output to experience results

swDuino ultrasonic sensor example output