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:examples:sensor:ultrasonic_distance [2015/11/10 12:40] heikopikneren:examples:sensor:ultrasonic_distance [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Ultrasonic distance sensor ====== ====== Ultrasonic distance sensor ======
  
-//Necessary knowledge: [HW] [[en:hardware:homelab:controller]], [HW] [[en:hardware:homelab:digi]], [AVR] [[en:avr:timers]], [LIB] [[en:software:homelab:library:timer]], [LIB] [[en:software:homelab:library:module:lcd_graphic]], [LIB] [[en:software:homelab:library:module:sensor]]//+//Necessary knowledge:  
 +[HW] [[en:hardware:homelab:digi]],  
 +[AVR] [[en:avr:timers]],  
 +[LIB] [[en:software:homelab:library:timer]], \\ 
 +[LIB] [[en:software:homelab:library:module:lcd_graphic]], [LIB] [[en:software:homelab:library:module:sensor]] //
  
 ===== Theory ===== ===== Theory =====
Line 120: Line 124:
  
  // Line selection  // Line selection
- lcd_gfx_goto_char_xy(1,2);+ lcd_gfx_goto_char_xy(1,1);
    
  // Name of the program  // Name of the program
Line 129: Line 133:
  
   // Endless loop.   // Endless loop.
- while (true)+ while (1)
  {  {
  // Measuring  // Measuring
Line 138: Line 142:
  {   {
  // converting the distance to text.  // converting the distance to text.
- sprintf(text, "%cm   ", distance);+ sprintf(text, "%3d cm   ", distance);
  }  }
  // Were there errors during the measuring ?  // Were there errors during the measuring ?
Line 156: Line 160:
 } }
 </code> </code>
-If older type sensor (SRF04) is used, then see page: \\ http://home.roboticlab.eu/en/examples/sensor/ultrasonic_distance_srf04+To make sure that the ultrasonic sensor actually start working, you should check whether the small LED will flash every measurement which is located on the back of the sensor.
en/examples/sensor/ultrasonic_distance.1447159207.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