[RESOLVED] Very INSANE Problem

Hi … for first i m sorry for my bad english… and plz try to ignore // comments for the program … i was tired to delete them :smiley:

I want to play starwars whit my piezo speaker during the robot avoids obstacles… I failed because when the starwars is playing the robot continues to go forward but the ultrasonic sensor doesnt detects anything…

I attached the file to the topic because it is to large to write it there…

THX FOR HELP !!

Alap.ino (46.8 KB)

It may not be the cause of your problem but using the tone() function prevents use of PWM on pins 3 and 11 and your program uses both for PWM.

How do you know that the sensor does not detect anything ?

I had tryed it ... and i had a drive for pwm and servo.. that s why i use that pins PLZ help me :((

I will attach a video in a few seconds

I am sorry but I can't make sense of your reply. The first step is to put some Serial.prints into your code to see what value the sensor is returning.

When you say that you have a drive do you mean that you have a motor driver board that forces you to use those pins ? What happens if you don't try to play any tones, does the robot work OK then ?

You've got a 48Kbyte sketch and you've only just found a problem with it? :fearful:

If the starwars song don t works the program is perfect before and after it but when the song begins it goes forward and doesnt detects anything... i will post some videos ... and yes i use a motor driver..

AWOL: You've got a 48Kbyte sketch and you've only just found a problem with it? :fearful:

yeah and i think u wont belive me but i m 12 years old :P my dad worked at electronics :)

goto here;

Uh-oh.

AWOL: goto here;

Uh-oh.

what ?

I worry when I see the word "goto" in a C program.

sry… my battery was low and the quality too but here they are … whit song and whitout

AWOL: I worry when I see the word "goto" in a C program.

If ur so good plz resolve that thing whitout goto command.. because if it enters in a very long duct what is locked in the end it can t come out of it .. only whit this command

lori3:

AWOL:
I worry when I see the word “goto” in a C program.

If ur so good plz resolve that thing whitout goto command… because if it enters in a very long duct what is locked in the end it can t come out of it … only whit this command

Certainly - PM me and I’ll send you my mailing address for you to post your hardware to me.

Its Arduino Mega 2560 but u will be better if u help me resolve that problem and ur not spending ur time whit goto command.. i used it if u think its wrong don t use it i don t care...

thx for help :)

A suggestion. Put some Serial.prints into your program so that you know which parts of it are running and when and what the value of important variables are at certain points, such as the distance returned by the sensor and print some messages so that you know which if commands are being executed as a result.

YOUR PRO IF U SLOVE THIS !! Hi all for first i m sorry for my bad english.. and plz try to ignore // comments for the program .. i was tired to delete them :)

I have an Arduino Mega 2560 -- i motor drive 2 pwm motor 1 ultrasonic sensor and a servo motor under it... I program it from about 1 month and now I get a problem what i never getted before.. I want to play starwars whit my piezo speaker and during that the robot avoid obstacles... If the starwars song don t works the program is perfect before and after it but when the song begins it goes forward and doesnt detects anything...

I attached the program and some photos to the topic...

THX FOR HELP!!

You miss you attachment. A picture of the system may help too (showing where is the buzzer and the ultrasonic sensor).

I think the last post was your first.

After looking to your code I should say: WHAT A BIG MESS!!! :astonished:

Comments are a good thing, but you should use it with caution. Too much comments are worse that none.

After that, the problem, I think that is that you when are playing the song don't have time to look at the sensors, so, the robot will go always forward. You need to look at the example BlinkWithoutDelay and try to figure out how you can delete all the delay() calls.

Hi… I’m new whit the arduino …I discovered serial monitor today and I searched it my question is that I can create a program that
receives my text message and understands it? for EXAMPLE: I send StarWars and it playes Starwars then continues to run the program normally…

THX for help

Alap.ino (42 KB)

Pick one place to post your question, and if it is in the wrong place a moderator will move it. Right now I just left a reply to the one you posted in Project Guidance.