Differences

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

Link to this comparison view

Next revision
Previous revision
en:software:homelab:library:module:sensor [2010/02/03 16:28]
127.0.0.1 external edit
en:software:homelab:library:module:sensor [2018/12/27 12:53] (current)
Line 1: Line 1:
-====== ​Andurid ​======+====== ​Sensors ​======
  
-//Seotud mooduliga: [HW] [[et:​hardware:​sensor|Andurite moodul]]//+//Related to: [HW] [[en:hardware:homelab:sensor]]//
  
-See teegi osa sisaldab kodulabori andurite kasutamise funktsioone.+This library contains functions to use different sensors in the HomeLab kit.
  
-===== Andmetüübid ​=====+===== Data Types =====
  
-  * **//​ir_distance_sensor//​** \\ Infrapuna-kaugusanduri kauguse arvutuse funktsiooni parameetrite struktuurKauguse arvutusvalem on  ​//a / (ADC + b) - k//. Struktuuri liikmed+  * **//​ir_distance_sensor//​** \\ 
-    * //a// - jagatav+    Infrared distance sensor distance calculation parameters structureFormula for distance calculation is //a / (ADC + b) - k//. Structure members
-    * //b// - vabaliige+    * //a// - Dividend
-    * //k// - korrigeerimiskonstant.+    * //b// - Non-linear constant
 +    * //k// - Linearizing constant.
  
-===== Konstandid ​=====+===== Constants ​=====
  
-    * **//​ir_distance_sensor GP2Y0A21YK//​** ​Sharp GP2Y0A21YK ​kaugusanduri parameetrite struktuuri objekt.+    * **//​ir_distance_sensor GP2Y0A21YK//​** ​\\ 
 +    ​Sharp GP2Y0A21YK ​distance calculation formula parameters.
  
-===== Funktsioonid ​=====+===== Functions ​=====
  
   * **//signed short thermistor_calculate_celsius(unsigned short adc_value)//​** \\   * **//signed short thermistor_calculate_celsius(unsigned short adc_value)//​** \\
-    ​Termistori temperatuuri arvutamine Celsiuse kraadides ​ADC muunduri väärtusestFunktsioon põhineb teisendustabelilParameetrid+    ​Calculates thermistor temperature in Celsius degrees from ADC conversion resultFunctions use pre-calculated conversion tableParameters
-    * //​adc_value//​ - ADC teisenduse väärtus+    * //​adc_value//​ - ADC conversion result (10-bit with +5 V reference voltage).
-    * Tagastab temperatuuri Celsiuse kraadides ​-20 kuni 100 kraadi piires.+    * Returns temperature in Celsius degrees in the -20 to 100 degrees limit.
  
   * **//signed short ir_distance_calculate_cm(ir_distance_sensor sensor, unsigned short adc_value)//​** \\   * **//signed short ir_distance_calculate_cm(ir_distance_sensor sensor, unsigned short adc_value)//​** \\
-    ​IR kaugusanduri väljundpinge ​ADC väärtuse sentimeetriteks ümberarvutamise funktsioonParameetrid+    ​Calculates distance from ADC result received from IR distance sensor voltageParameters
-    * //sensor// - Kaugusanduri parameetrite struktuuri objekt+    * //sensor// - Distance sensor calculation parameters
-    * //​adc_value//​ - 10-bitine ​+5 V võrdluspingega ADC väärtus+    * //​adc_value//​ - ADC conversion result (10-bit with +5 V reference voltage)
-    * Tagastab kauguse sentimeetrites või -1, kui seda ei saanud arvutada.+    * 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)//** \\ 
-    ​Ultraheli-kaugusanduri mõõtmise teostamise funktsioon. Funktsioon tekitab ​SRF04 kaugusmõõdiku päästikuimpulsi ja mõõdab kajaimpulsi saabumise aegaAja põhjal arvutatakse objekti kaugusMõõtmine võtab aega kuni 36 msFunktsioon eeldab ​14.7456 MHz mikrokontrolleri taktsagedustParameetrid+    ​Measures distance with ultrasonic distance sensor ​SRF04. ​Function generates a trigger pulse on one pin and measures the time of echo pulse on another pinDistance is calculated from the timeFunction expects a 14.7456 MHz clock frequencyMeasuring may take up to 36 ms. Parameters
-    * //trigger// - päästiku viigu muutuja+    * //trigger// - Trigger pin variable
-    * //echo// - kaja viigu muutuja+    * //echo// - Echo pin variable
-    * Tagastab kauguse sentimeetrites või 0, kui mõõtmine ebaõnnestus.+    * Returns distance in centimeters or 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.
  
-===== Näide ​=====+===== Example ​===== 
 + 
 +The following program demonstrates usage of IR and ultrasonic distance sensor SRF05.
  
 <code c> <code c>
 #include <​homelab/​module/​sensors.h>​ #include <​homelab/​module/​sensors.h>​
  
-// Ultraheli kaugusmõõdiku juhtviigud +// 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)
 { {
- unsigned short adc_value = 400; // näidisväärtus+ unsigned short adc_value = 400; // random ADC result.
  signed short distance;  signed short distance;
  
- // IR kaugusanduri ​ADC väärtuse sentimeetriteks teisendamine+ // Distance calculation from IR distance sensor ​ADC result.
  distance = ir_distance_calculate_cm(GP2Y0A21YK,​ adc_value);  distance = ir_distance_calculate_cm(GP2Y0A21YK,​ adc_value);
  
- // Ultraheli-kaugusanduriga mõõtmine + // 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.1265207294.txt.gz · Last modified: 2013/03/26 23:02 (external edit)
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