76 956
Assignments Done
Successfully Done
In June 2019

Answer to Question #33312 in C++ for sandar

Question #33312
Hello this is my program.Now I am using this program for 6 ultrasonic sensor and then this program for pin 9. I don't know how to array for 6 ultrasonic sensor.please help me.thanks!

int ultraSoundpin = 9;
unsigned long ultrasoundDuration = 0;

void setup() {

void loop() {

// switch pin to output
pinMode(ultraSoundpin0, OUTPUT);

// send a low, wait 2 microseconds, send a high then wait 10 microseconds
digitalWrite(ultraSoundpin0, LOW);
digitalWrite(ultraSoundpin0, HIGH);
digitalWrite(ultraSoundpin0, LOW);

// switch pin to input
pinMode(ultraSoundpin0, INPUT);

// wait for a pulse to come in as high
ultrasoundDuration0 = pulseIn(ultraSoundpin0, HIGH);

// output
Serial.print(ultrasoundDuration0/58, DEC);
Serial.print(" cm");

Expert's answer

Not answered

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions