Aj Ty v IT: Rozdiel medzi revíziami
Zo stránky SensorWiki
Riadok 56: | Riadok 56: | ||
[[Súbor:gemma_flora_selectusbtiny.gif|center]] | [[Súbor:gemma_flora_selectusbtiny.gif|center]] | ||
Vyskúšame postupne jednoduché programy | |||
<source lang="Cpp"> | |||
/* Blink 1 */ | |||
#define RED_LED 1 | |||
void setup() { | |||
pinMode(RED_LED, OUTPUT); | |||
} | |||
void loop() { | |||
digitalWrite(RED_LED, HIGH); | |||
delay(200); | |||
digitalWrite(RED_LED, LOW); | |||
delay(200); | |||
} | |||
</source> | |||
<source lang="Cpp"> | |||
/* Blink 3 */ | |||
#define RED_LED 0 | |||
#define GREEN_LED 1 | |||
#define BLUE_LED 2 | |||
void setup() { | |||
pinMode(RED_LED, OUTPUT); | |||
pinMode(GREEN_LED, OUTPUT); | |||
pinMode(BLUE_LED, OUTPUT); | |||
} | |||
void loop() { | |||
digitalWrite(RED_LED, HIGH); | |||
delay(200); | |||
digitalWrite(RED_LED, LOW); | |||
delay(200); | |||
digitalWrite(GREEN_LED, HIGH); | |||
delay(200); | |||
digitalWrite(GREEN_LED, LOW); | |||
delay(200); | |||
digitalWrite(BLUE_LED, HIGH); | |||
delay(200); | |||
digitalWrite(BLUE_LED, LOW); | |||
delay(200); | |||
} | |||
</source> |
Verzia z 11:03, 13. jún 2017
![](/sensorwiki/images/thumb/7/76/LogoAjTyvIT.png/150px-LogoAjTyvIT.png)
Svetielkujúci Workshop 7. a 14. 6. 2017
Úvod
Krok za krokom
1. Blink
2. Železničné priecestie
3. K.I.T.T. 2000
Druhá časť
Adafruit Gemma
![](/sensorwiki/images/thumb/5/5a/AdafruitGemma.png/500px-AdafruitGemma.png)
V programovacom prostredí Arduino treba najprv nastaviť typ elektronickej dosky na Adafruit Gemma 8MHz v menu Tools->Board.
![](/sensorwiki/images/9/9c/Flora_gemmaselect.gif)
Potom ešte treba vybrať vhodný programovací protokol -
vyeberiete ho z menu Tools->Programmer->USBtinyISP
![](/sensorwiki/images/0/01/Gemma_flora_selectusbtiny.gif)
Vyskúšame postupne jednoduché programy
/* Blink 1 */
#define RED_LED 1
void setup() {
pinMode(RED_LED, OUTPUT);
}
void loop() {
digitalWrite(RED_LED, HIGH);
delay(200);
digitalWrite(RED_LED, LOW);
delay(200);
}
/* Blink 3 */
#define RED_LED 0
#define GREEN_LED 1
#define BLUE_LED 2
void setup() {
pinMode(RED_LED, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(BLUE_LED, OUTPUT);
}
void loop() {
digitalWrite(RED_LED, HIGH);
delay(200);
digitalWrite(RED_LED, LOW);
delay(200);
digitalWrite(GREEN_LED, HIGH);
delay(200);
digitalWrite(GREEN_LED, LOW);
delay(200);
digitalWrite(BLUE_LED, HIGH);
delay(200);
digitalWrite(BLUE_LED, LOW);
delay(200);
}