I basically want the EchoSendRecieveNorth/East/West to read the time it takes till it gets back, convert that to centimeters and store that to Ncm/Ecm/Wcm. I then want to read these values and to make a decision based on these values. Then after that decision has been made I want then to execute the things, and rescan the area. How do I store these value's? Here is my code:
You've got an awful lot of code there for someone who doesn't know how to assign a simple variable.
What I'm trying to say is that if this is really where you're stuck, then it would do you a lot of good to look at a few basic C++ tutorials and maybe a few of the example sketches that come with the IDE.
What you're asking right now is analogous to... "I am gonna drive this truck, now what is a steering wheel?"
If you want to copy and paste your way through writing code that's fine, just don't expect to be able to modify any of it in any meaningful way.
Delta_G:
You've got an awful lot of code there for someone who doesn't know how to assign a simple variable.
What I'm trying to say is that if this is really where you're stuck, then it would do you a lot of good to look at a few basic C++ tutorials and maybe a few of the example sketches that come with the IDE.
What you're asking right now is analogous to... "I am gonna drive this truck, now what is a steering wheel?"
If you want to copy and paste your way through writing code that's fine, just don't expect to be able to modify any of it in any meaningful way.
This is a school project, I need to make a car that can drive through a maze. The code your seeing is not complicated, it is just much. I don't want to copy paste code, I only have written this code because I understand it. I cannot find an example sketch that I am looking for, so I see what I have to do, but I do not get what the code means so I am not going to implement it unless I can see what it means.
Grumpy_Mike:
In variables by using the equals sign =
OK what am I missing here, what are you really asking?
I want to store the values that it reads (the Pulseln(ontvanger, HIGH) and then read it a second later to make a decision.
I have a servo car that I want to do the following
(also has a servo with hc sr04 on top)
start at 12* Measure distance to east (right of the car) store to: Ecm
Turn 90* so its at 102 degrees and then measure the distance to north (in front of the car) and store to: Ncm
Turn 90* so its at 192 degrees and then measure the distance to west (left of the car) and store to: Wcm
If there is an object within xx cm then I want it to take an action
If Ecm is smaller then 30(cm) and if Ncm is smaller then 30(cm) then I want it to turn right after 0.5 seconds for example.
The problem is the storing to, I tried modifying it a bit:
That is not going to do anything useful because Serial.println does not return the value it just printed.
EEPROM.write(Eastcm,cm);
Only use the EEPROM if you want to maintain the values when you power the board down. As you have it you will soon burn the EEPROM out, it is limited to 100,000 writes.
I still don't understand why the concept of storing your values in a variable is giving you problems.