Olayiwola Ayinde ByteHub
Published © CC BY-NC-SA

Range Finder Using CloudX Microcontroller Board

This project measures distance in cm using the ultrasonic sensor and displays readings on the popular TM1637 seven segment display module.

BeginnerProtip24 minutes724
Range Finder Using CloudX Microcontroller Board

Things used in this project

Hardware components

Microchip CloudX Microcontroller Board
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Arduino TM1637 segment module
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1

Software apps and online services

CloudX IDE

Story

Read more

Custom parts and enclosures

Distance

Testing

Schematics

Ultrasonic distance

Code

Ultrasonic Distance

C Header File
#include <CloudX\Ultrasonic.h>
#include <CloudX\Segment_TM1637.h>
#include <CloudX\Ultrasonic.h>

#define trig 5
#define echo 6

#define clk 1
#define dio 2


int distance;
setup(){
           //setup here
           SegmentTM1637_setting(dio, clk, 5);
           Ultrasonic_init(1,trig,echo);
           SegmentTM1637_write(0);

loop(){
           //Program here
          distance = Ultrasonic_read(1); //returns value in cm
          SegmentTM1637_write(distance); 
          delay(100);
      }
} 

Credits

Olayiwola Ayinde ByteHub
2 projects • 0 followers
An Embedded Systems Engineer, an Inventor, Tech Instructor and Educationist, Opensource Technology enthusiasts, Co-Founder ByteHub Embedded

Comments