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
de:examples:sensor:ultrasonic [2009/09/20 10:54] mikk.leinide:examples:sensor:ultrasonic [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 69: Line 69:
    
  // Adjust timer period so that we get 1cm of  // Adjust timer period so that we get 1cm of
- // distance every overflow. + // measured distance every overflow
- ICR1 = 900;+ // 
 + // Formula: 
 + // Timer period = clock rate / speed of sound in centimeters * 2 
 + // The period is multiplied by 2 because the sound travels 
 + // forth and back
 + ICR1 = 893;
    
  // Enable overflow interrupt  // Enable overflow interrupt
Line 78: Line 83:
 // //
 // Delay // Delay
-// Time in ~0.06 of milliseconds +// Time in ~60 of microseconds
-// (the time of sound wave travelling 1cm forth and back)+
 // //
 void delay(unsigned int time) void delay(unsigned int time)
de/examples/sensor/ultrasonic.1253444087.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