Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:software:homelab:library:module:sensor [2010/03/29 17:40] Helenen:software:homelab:library:module:sensor [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 3: Line 3:
 //Related to: [HW] [[en:hardware:homelab:sensor]]// //Related to: [HW] [[en:hardware:homelab:sensor]]//
  
-This library contains functions to use different sensors in Homelab kit.+This library contains functions to use different sensors in the HomeLab kit.
  
-===== Data types =====+===== Data Types =====
  
   * **//ir_distance_sensor//** \\   * **//ir_distance_sensor//** \\
Line 31: Line 31:
     * Returns distance in centimeters or -1 if it cannot be calculated.     * Returns distance in centimeters or -1 if it cannot be calculated.
  
-  * **//unsigned short ultrasonic_measure(pin trigger, pin echo)//** \\ +  * **//unsigned short ultrasonic_measure_srf04(pin trigger, pin echo)//** \\ 
-    Measures distance with ultrasonic distance sensor. Functions generate a trigger pulse on one pin and measures the time of echo pulse on another pin. Distance is calculated from the time. Function expects a 14.7456 MHz clock frequency. Measuring may take up to 36 ms. Parameters:+    Measures distance with ultrasonic distance sensor SRF04Function generates a trigger pulse on one pin and measures the time of echo pulse on another pin. Distance is calculated from the time. Function expects a 14.7456 MHz clock frequency. Measuring may take up to 36 ms. Parameters:
     * //trigger// - Trigger pin variable.     * //trigger// - Trigger pin variable.
     * //echo// - Echo pin variable.     * //echo// - Echo pin variable.
 +    * Returns distance in centimeters or 0 when measuring failed.
 +  * **//unsigned short ultrasonic_measure_srf05(pin trigger_echo)//** \\
 +    Measures distance with ultrasonic distance sensor SRF05 in one wire regime. Function generates a trigger pulse on the pin and measures the time of echo pulse on the same pin. Distance is calculated from the time. Function expects a 14.7456 MHz clock frequency. Measuring may take up to 36 ms. Parameters:
 +    * //trigger_echo// - Trigger/Echo combined pin variable.
     * Returns distance in centimeters or 0 when measuring failed.     * Returns distance in centimeters or 0 when measuring failed.
  
 ===== Example ===== ===== Example =====
  
-The following program demonstrates usage of IR and ultrasonic distance sensors.+The following program demonstrates usage of IR and ultrasonic distance sensor SRF05.
  
 <code c> <code c>
Line 45: Line 49:
  
 // Ultrasonic distance sensor control pins. // Ultrasonic distance sensor control pins.
-pin pin_trigger = PIN(G, 1); +pin pin_triggerecho    = PIN(G, 0);
-pin pin_echo    = PIN(G, 0);+
  
 int main(void) int main(void)
Line 57: Line 60:
  
  // Measuring with ultrasonic distance sensor.  // Measuring with ultrasonic distance sensor.
- distance = ultrasonic_measure(pin_trigger, pin_echo);+ distance = ultrasonic_measure_srf05(pin_triggerecho);
 } }
 </code> </code>
- 
en/software/homelab/library/module/sensor.1269884417.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0