This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:examples:sensor:ultrasonic_distance [2015/11/10 12:30] – heikopikner | en: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: | + | //Necessary knowledge: |
| + | [HW] [[en: | ||
| + | [AVR] [[en: | ||
| + | [LIB] [[en: | ||
| + | [LIB] [[en: | ||
| ===== Theory ===== | ===== Theory ===== | ||
| Line 94: | Line 98: | ||
| // Pins of ultrasonic sensor | // Pins of ultrasonic sensor | ||
| // Robotic HomeLab II | // Robotic HomeLab II | ||
| - | pin pin_pin_trigger_echo = PIN(F, 2); | + | //pin pin_pin_trigger_echo = PIN(F, 2); |
| // Robotic HomeLab III | // Robotic HomeLab III | ||
| Line 120: | Line 124: | ||
| // Line selection | // Line selection | ||
| - | lcd_gfx_goto_char_xy(1, | + | lcd_gfx_goto_char_xy(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, | + | sprintf(text, |
| } | } | ||
| // Were there errors during the measuring ? | // Were there errors during the measuring ? | ||
| Line 156: | Line 160: | ||
| } | } | ||
| </ | </ | ||
| - | If older type sensor | + | To make sure that the ultrasonic |