/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
You have a non-exclusive, revocable, worldwide, royalty-free license
for personal and commercial use. Attribution is optional; modifications
are allowed, but you're responsible for code maintenance. We're not
liable for any loss or damage. For full terms,
please visit pleasedontcode.com/termsandconditions.
- Project: "Motorized Sensor"
- Source Code compiled for: Arduino Uno
- Source Code created on: 2024-01-11 13:43:28
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* motor driver */
/****** SYSTEM REQUIREMENT 2 *****/
/* motor driver */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include
#include
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* motor driver */
// Define any motor driver libraries or functions here
/****** SYSTEM REQUIREMENT 2 *****/
/* motor driver */
// Define any motor driver libraries or functions here
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t HC_SR04_ECHO_PIN = 3;
/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t HC_SR04_TRIGGER_PIN = 2;
/****** DEFINITION OF LIBRARY CLASS INSTANCES *****/
Ultrasonic ultrasonic(HC_SR04_TRIGGER_PIN, HC_SR04_ECHO_PIN);
void setup(void)
{
// Motor driver setup code here
// Ultrasonic sensor setup code here
pinMode(HC_SR04_ECHO_PIN, INPUT);
pinMode(HC_SR04_TRIGGER_PIN, OUTPUT);
Serial.begin(9600);
}
void loop(void)
{
// Motor driver loop code here
// Ultrasonic sensor loop code here
Serial.print("Distance in CM: ");
Serial.println(ultrasonic.read());
delay(1000);
}