what’s wrong in this??
arduinoworks1-1.ino (1.04 KB)
what’s wrong in this??
arduinoworks1-1.ino (1.04 KB)
What's wrong?
You attached your code instead of posting it.
You have 2x loop()s, and a block of code that's not in a function, probably meant to be in setup().
Why did you report your post to a moderator just 4 minutes after posting it ?
Continued idiotic posts and reports will lead to a suspension of the account and possibly a ban
10102020:
what’s wrong in this??
Possibly your ridiculous typeface choice :o
float ultrasonic_distance_2_3(); {
digitalWrite(2, LOW);
digitalWrite(3, LOW);
delayMicroseconds(5);
digitalWrite(2, HIGH);
delayMicroseconds(10);
digitalWrite(2, LOW);
unsigned long sonic_duration = pulseIn(3, HIGH);
float distance_cm = (sonic_duration / 2.0) / 29.1;
return distance_cm;
}
void setup()
{
pinMode(0, OUTPUT);
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
pinMode(7, OUTPUT);
digitalWrite(0,HIGH);
digitalWrite(2,LOW);
digitalWrite(4,HIGH);
digitalWrite(7,LOW);
}
void loop()
{
}
{
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode( 2 , OUTPUT);
pinMode( 3 , INPUT);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
}
void loop()
{
if (ultrasonic_distance_2_3( ) < 0); {
if (_E5_B7_A6_E5_8F_B3 == "左"); {
_E5_B7_A6_E5_8F_B3 = "右";
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
} else {
_E5_B7_A6_E5_8F_B3 = "左";
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
}
}
}
float ultrasonic_distance_2_3(); {
Oops
Or it may be something to do with the fact that the code has 2 loop() functions in it and code outside of any function
This post looks very similar to another post already....repeat post??
Power_Broker:
Possibly your ridiculous typeface choice :o
+1
...R
void setup()
{
{ float ultrasonic distance 2_3();
Serial.begin(9600);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
delayMicroseconds(5);
digitalWrite(2, HIGH);
delayMicroseconds(10);
digitalWrite(2, LOW);
unsigned long sonic_duration = pulseIn(3, HIGH);
float distance_cm = (sonic_duration / 2.0) / 29.1;
return distance_cm;
pinMode(0, OUTPUT);
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
pinMode(7, OUTPUT);
digitalWrite(0,HIGH);
digitalWrite(2,LOW);
digitalWrite(4,HIGH);
digitalWrite(7,LOW);
}
}
float ultrasonic distance 2_3();
void loop()
{
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode( 2 , OUTPUT);
pinMode( 3 , INPUT);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
}
void loop()
{
if (ultrasonic_distance_2_3( ) < 0); {
if (_E5_B7_A6_E5_8F_B3 == "左"); {
_E5_B7_A6_E5_8F_B3 = "右";
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
} else {
_E5_B7_A6_E5_8F_B3 = "左";
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
}
}
}
you have to tell people what its doing wrong... then maybe we can help fix it. we dont even know what you are trying to do.
taterking:
you have to tell people what its doing wrong... then maybe we can help fix it. we dont even know what you are trying to do.
thank you that you've remind me!!
i will have a photonext time!
float ultrasonic distance 2_3();
void loop()
{
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode( 2 , OUTPUT);
pinMode( 3 , INPUT);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
}
void loop()
{
if (ultrasonic_distance_2_3( ) < 0); {
if (_E5_B7_A6_E5_8F_B3 == "左"); {
_E5_B7_A6_E5_8F_B3 = "右";
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
} else {
_E5_B7_A6_E5_8F_B3 = "左";
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
}
}
}
photo that tells you what's wrong in the code
file:///C:/Users/Chuck/Desktop/error%20QuQ.png
Don't cross post; did you not like the answers in https://forum.arduino.cc/index.php?topic=663662?
ultrasonic_distance_2_3( ) is a function; but it's not in your code
2)
what is this meant to be
float ultrasonic distance 2_3();
You have two loop() functions (as indicated in your other thread). Why did you not continue in there?
Please read How to use this forum - please read. - Installation & Troubleshooting - Arduino Forum, specifically point #7 about posting code.
Don't post photos of errors.
And we can not look at your PC.
Do not crosspost; reported.
Merging. Lots of merging. Good luck all.
I’m still waiting to find out what the code does, and when it’s going to be posted properly with a proper link to any attached photos, or inline photos.
I’m guessing the OP is an over-enthusiastic 12 year old.