Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : MM and the HH10D
Author | Message | ||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1873 |
Yes me again with another problem. I have a humidity sensor which gives out a frequency depending on humidity. I have it connected to pin 11. With no program in memory if I type into the keyboard; SETPIN 11,3 PRINT PIN(11) it gives me the frequency in Hz. However if I write a two line program; 10 SETPIN 11,3 20 PRINT PIN(11) RUN it gives me a zero Anyone know what I am doing wrong. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3800 |
At a guess, not giving it time? Delay a little between the lines? |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1425 |
That should be it. In order to measure a frequency, you have to give the MM a chance to measure that frequency. I would suggest: 10 SETPIN 11,3 15 PAUSE 2000 20 PRINT PIN(11) RUN Micromites and Maximites! - Beginning Maximite |
||||
seco61 Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 205 |
Hi Paul. See the code that was posted in your original HH10D post. Remember that the MMBasic code will execute approximately 30000 lines of code a second. The HH10D will have an output frequency of around 5 - 10kHz. In the time that MMBasic has executed 2 lines of code you will see a value of 0 or 1 returned. For an accurate frequency measurement you will need to wait at least a second between readings, and between setting the pin to frequency measurement and using the value. Regards Gerard (vk3cg/vk3grs) |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1873 |
Thanks all, I now remember seeing that somewhere, problem solved. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Print this page |