2012a simulink arduino, fast timer, DHT22
1 view (last 30 days)
Show older comments
I am using the Simulink R2012a interface with arduino. I am currently not using the embedded coder. I am trying to interface with a humidity temperature senser, DHT22. It has it's own interface, I found some arduino C libraries. It is a one wire interface, not the standard. Every 2 or so Seconds I plan to read from this sensor. To read the sensor I follow this pattern
1. Pull signal low for greater than 500us. -> 2. Pull signal high for 20-40us. -> 3. Sensor pulls data low for 80us. -> 4. Sensor pulls data high for 80us. -> 5. Then comes the transimission of data (If a high pulse is less than 30us it is a 0) (If a high pulse is 30 - 70 us than it is a 1)
So I have to read and write a pin in 10s of useconds. So I guess my question is how can I read and write an I/O pin that fast in simulink?
0 Comments
Answers (1)
Walter Roberson
on 12 Apr 2012
You cannot read an I/O pin that fast in Simulink itself. You might be able to do it with some mex code, but I believe that would be too slow as well.
It sounds to me as if what you should be doing is triggering an arduino sketch that does the work.
3 Comments
Walter Roberson
on 12 Apr 2012
http://arduino.cc/en/Tutorial/Sketch
"A sketch is the name that Arduino uses for a program. It's the unit of code that is uploaded to and run on an Arduino board. "
See Also
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!