Go Down

Topic: Arduino with magnetic sensor...Help please.! (Read 3503 times) previous topic - next topic


I use an arduino uno with a magnetic sensor because i want to create a parking spaces availability.! I have already finish the code to detect the change of the sensor values when a car park over the sensor.. And now i want to write a code to find the time of this change.. What is the easiest method.?? I am thinking to send the data into an array and compare the values so i can find the change between the values.. I am not sure how can i do it.. If anyone can help me with his advice or with example of code please reply..!! Thank you.!

In this picture are the values that i take from the sensor.. the grad value change when i have magnetic field over the sensor.. As you can see grad=149.08, grad= 147.65, grad= 148.53, grad= 149.08 and after that i place magnetic field go to grad= -15.11, grad= -130.60, grad= -129.89, grad= -130.60, grad= -129.89. This is the change that i want to detect and for example after that i will turn on the led.!


now i want to write a code to find the time of this change.. What is the easiest method.??

There is a Time library that can help:  http://playground.arduino.cc/Code/Time

You will probably want to add a Real Time Clock since the Arduino is not great at keeping time by itself.

Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


You can use millis() to determine, relative to when the Arduino started, when the value changed to "car parked here" or when it changed to "no car parked here". The difference is how long the car was parked there, in milliseconds. Converting that to seconds, minutes, hours, days, etc. is simple math.
The art of getting good answers lies in asking good questions.


Thank you very much for help..!! It was very important for me.! Thank you again.!

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131