Can Anyone Please Convert the following Arduino Code to Embedded c code? I am very thankful to the one who converts this to an embedded c code. (this code is for Arduino lcd interfacing with Ultrasonic sensor)
#include <LiquidCrystal.h>
int inches = 0;
int cm = 0;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
pinMode(7, INPUT);
}
void loop() {
lcd.clear();
cm = 0.01723 * readUltrasonicDistance(7);
inches = (cm / 2.54);
if (cm<40){
lcd.setCursor(0, 0);
// print the number of seconds since reset:
lcd.print("Caution: ");
lcd.setCursor(0,1);
lcd.print("Objects Nearby");
delay(1000);
}
}
long readUltrasonicDistance(int pin)
{
pinMode(pin, OUTPUT); // Clear the trigger
digitalWrite(pin, LOW);
delayMicroseconds(2);
// Sets the pin on HIGH state for 10 micro seconds
digitalWrite(pin, HIGH);
delayMicroseconds(10);
digitalWrite(pin, LOW);
pinMode(pin, INPUT);
// Reads the pin, and returns the sound wave travel time in microseconds
return pulseIn(pin, HIGH);
}