![]() you can have a couple to limit the frequency variation Or you could even use map and have it change the figure to a frequency. you need to have the 1.5 as the first case. basically do nothing when its above 3v except add a delay. You can have two if statements and an else. I'm going to give you some hints rather than the actual code. ![]() Well done though for correctly identifying the error message and sorting out the solution. ![]() The first part of the code sets up the compiler that generates the file that gets dumped into the Arduino, so it's necessary. I only posted the loop() part of the code. I made the assumption you were reasonably familar with Arduino IDE. the loop routine runs over and over again forever:įloat voltage = sensorValue * (3.3 / 1023.0) initialize serial communication at 9600 bits per second: the setup routine runs once when you press reset: I hope it helps someone on a similar quest. Here's the working code and the video of it working. So if the distance detected is not activating the buzzer, the reading is very fast, but as soon as the buzzer is activated, I only get the readings each time the buzzer sounds, which means depending on the delay of the sound the faster or slower I get the readings. The only thing that still is making me pull my hair is that the readings in the Arduino serial monitor are only refreshed as fast as the Buzzer delay. So finally I managed to make the code work. If you hunt around the internet you'll find free copies and this includes the later version. It is something I highly recommend as it tackles problems from the "I have this issue what can I use" rather than just explaining what each command does. It could be that this is also adding what appears to be a delay in your video. If you need to have data in your final version, you could simply send the output only when it changes which of the if statements you are in of one of 4 states.Įven if you speed up this, you're going to be overwhelmed by the data coming in, so you may want to think about how useful it is, or what you want in the final version.ĭo you have any specs on what rate your laser ranger does the detection and conversion to a voltage?. You can very that by commenting it out and seeing how quick it responds. If someone has a clue of how to get it to display the readings at a fast rate all the time I'll appreciate the help.Įach numerial is 8 bits of data and that takes time to send, so bump the Serial.begin from 9600 to 115200 (don't forget to set the terminal to 115200)ĪnalogRead takes time (about 104uS) so thats not really holding you up, but the Serial.print will be. Well done on the code, apart from the hair pulling I'm sure you've learnt heaps. I’ve been fideling around with it but couldn’t manage to find a solution.ĭoes anyone would know how could I be able to achieve this amazingly complex engineering project. I’m only missig the code to do everything interact with each other. So far I manage to make the Arduino read the voltage fluctuation and already created a project where I make the buzzer work in diferent timer intervals and frequencies. Of course the distances in this case would be read as voltages for the arduino. I was planing on having two different signals for different distances e.g at 5m would start to buzz every half a second in a certain frequency (700Hz) and when it would reach 2m would buzz every 1/8 of a second in the same frequency. I have a laser that mesures distances with a board which I can make it output a Voltage depending on how far it is from an object, and the final objecting is activating a buzzer whenever in reaches a certain threshold. I started thinking and it would be the perfect solution for a project that I’ve been wanting to do for a long time. I’ve recently bought an Arduino, start playing with it and realised the potential of this device. I’ve been an electronics curious since a child but never got in too deep.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |