This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| et:projects:myndisortija [2011/05/23 09:20] – raivo.sell | et:projects:myndisortija [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 76: | Line 76: | ||
| ==== Galerii ==== | ==== Galerii ==== | ||
| - | ==== Videod ==== | + | * [[https:// |
| + | * [[https:// | ||
| - | === Töötuba näidiskood | + | ==== Meedia |
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| - | {{: | ||
| - | |||
| - | <code c> | ||
| - | // | ||
| - | |||
| - | // Roboti näidisprogramm | ||
| - | |||
| - | // | ||
| - | |||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | |||
| - | |||
| - | // | ||
| - | // Ultraheli anduri ja multiplekseri viigud | ||
| - | |||
| - | // | ||
| - | |||
| - | pin multiplekser = PIN(G,0); | ||
| - | |||
| - | pin pin_trigger = PIN(F, 0); | ||
| - | |||
| - | |||
| - | |||
| - | // Nuppude viigud | ||
| - | |||
| - | |||
| - | |||
| - | pin buttons[3] = { PIN(C, 2), PIN(C, 1), PIN(C, 0) }; | ||
| - | |||
| - | |||
| - | |||
| - | // | ||
| - | |||
| - | // Põhiprogramm | ||
| - | |||
| - | // | ||
| - | |||
| - | int main(void) | ||
| - | |||
| - | { | ||
| - | |||
| - | unsigned short distance; | ||
| - | |||
| - | char text[16]; | ||
| - | |||
| - | |||
| - | |||
| - | // Multiplekseri seadistamine | ||
| - | |||
| - | pin_setup_output(multiplekser); | ||
| - | |||
| - | pin_set(multiplekser); | ||
| - | |||
| - | |||
| - | |||
| - | // Nuppude seadistamine sisendiks | ||
| - | |||
| - | |||
| - | |||
| - | for (int i = 0; i < 3; i++) pin_setup_input(buttons[i]); | ||
| - | |||
| - | |||
| - | |||
| - | // Mootorite seadistamine | ||
| - | |||
| - | dcmotor_init(0); | ||
| - | |||
| - | dcmotor_init(1); | ||
| - | |||
| - | |||
| - | |||
| - | // Servo seadistamine | ||
| - | |||
| - | |||
| - | |||
| - | servomotor_init(0); | ||
| - | |||
| - | |||
| - | |||
| - | // LCD ekraani algseadistamine | ||
| - | |||
| - | lcd_gfx_init(); | ||
| - | |||
| - | |||
| - | |||
| - | // Ekraani puhastamine | ||
| - | |||
| - | lcd_gfx_clear(); | ||
| - | |||
| - | |||
| - | |||
| - | // Taustavalgustuse tööle lülitamine | ||
| - | |||
| - | lcd_gfx_backlight(true); | ||
| - | |||
| - | |||
| - | |||
| - | // Programmi nime kuvamine | ||
| - | |||
| - | lcd_gfx_goto_char_xy(1, | ||
| - | |||
| - | lcd_gfx_write_string(" | ||
| - | |||
| - | |||
| - | |||
| - | // Väike paus | ||
| - | |||
| - | _delay_ms(100); | ||
| - | |||
| - | |||
| - | |||
| - | // Lõputu tsükkel | ||
| - | |||
| - | while (true) | ||
| - | |||
| - | { | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | // Algoritm tuleb siia! | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | } | ||
| - | |||
| - | } | ||
| - | </ | ||
| ==== Kontakt ==== | ==== Kontakt ==== | ||