際際滷

際際滷Share a Scribd company logo
ARDUINO NAPLNO
Adam Hoica
Vojtch Suk
Kdo jsme
Arduino * Wiring AVR * C
Adam Hoica Vojtch Suk
Co n叩s ek叩?
HWSW
SW NAPLNO
Arduino IDE
 Aktu叩ln 1.6.1 (bezen 2015)
 Novinky v 1.6.0
 Rychlej邸鱈 kompilace, autodetekce COM portu, 鱈sla
叩dk哲, CLI, podpora pro v鱈ce HW platforem, 
 Detekce neautorizovan箪ch desek
 Ano je to IDE, ale
 Editor
Extern鱈 editor
Organizace Sketch
 Organizace na disku
 [dir] sketch
sketch.ino
settings.ino
utils.ini
Stejn辿 jm辿no
Arduino naplno (Arduino Day 2015)
Arduino naplno (Arduino Day 2015)
Arduino naplno (Arduino Day 2015)
#line 1 "sketch.ino
#include "Arduino.h"
void setup();
void loop();
void led_setup();
void led_on();
void led_off();
#line 1
void setup() {
led_setup();
}
void loop() {
led_on();
delay(1000);
led_off();
delay(1000);
}
#line 1 "settings.ino"
const int LED = 13;
#line 1 "utils.ino"
void led_setup() {
pinMode(LED, OUTPUT);
}
void led_on() {
digitalWrite(LED, HIGH);
}
void led_off() {
digitalWrite(LED, LOW);
}
Organizace Sketch  co d叩l
 Preprocessing nen鱈 spolehliv箪
 Pouze deklarace funkce
 Skatch nemus鱈 obsahovat jen *.ino
 Pou転鱈vejte klasick辿 *.cpp/*.h soubory
Arduino IDE CLI
arduino [FILE.ino]
arduino [--verify|--upload] [--board package:arch:board[:parameters]]
[--port portname] [--pref name=value] [-v|--verbose] [FILE.ino]
Nap.:
arduino --upload /path/to/sketch/sketch.ino
Alternativn:
make
https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc
Jin辿 IDE
 Eclipse
 Pro arduino (http://www.baeyens.it/eclipse/index.html)
 AVR Studio
 Atmel procesory
 Postaven辿 nad VS
 Visual Pro Micro
 Pro VS a AVR Studio
CodeBender
https://codebender.cc/
PROGRAMOVN
Wiring
Mnoho textu 邸kod鱈
 Pi spu邸tn鱈 se data programu (promnn辿) kop鱈ruj鱈
do RAM
 Vetn v邸eho textu
Mnoho textu 邸kod鱈
 Re邸en鱈: funkce F()
Serial.println(F(Lorem ipsum));
Delay
void loop()
{
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
int ledState = LOW;
unsigned long last = 0;
void loop()
{
unsigned long now = millis();
if(now - last >= 1000) {
last = now;
if (ledState == LOW) ledState = HIGH;
else ledState = LOW;
digitalWrite(13, ledState);
}
 nco u転iten辿ho 
}
Kooperativn鱈 multitasking
LED
 Je as rozsv鱈tit?
 Ano/Ne
Tla.
 Zm叩knuto tla鱈tko?
 Ano/Ne
Serial
 Data z PC?
 Ano/ne
Stavov箪 automat
 Rozdlit chov叩n鱈 aplikace/叩sti aplikace do
stav哲
 Knihovna FiniteStateMachine (Wiring)
Chytr箪 blika
Off
Blinking
Lerning
Lerning
Done
DEMO TIME
Debuger
 V箪pis na Serial.println(myVariable);
#ifdef DEBUG
#define TRACE(x) Serial.println(x);
#else
#define TRACE(x)
#endif
Visual Pro Micro
 Roz邸鱈en鱈 pro Visual Studio
 Funguje i v Community edition
 Placen辿
 Na forum se e邸鱈 port do Eclipse
 Um鱈 debugger bez extern鱈ho HW
 Peklad + instrumentace
Arduino naplno (Arduino Day 2015)
Arduino naplno (Arduino Day 2015)
Skuten箪 debugger
 debugWire, JTAG
 ATmega328P Xplained Mini
 AVR Studio, GDB
Jak zrychlit?
 Arduino.h je univerz叩ln鱈
 ale pomal辿
 Nap. digitalWrite
1) digitalWrite
#define output 2
void setup () {
pinMode(output, OUTPUT);
}
void loop() {
digitalWrite(output, HIGH);
digitalWrite(output, LOW);
}
2) PORTD
2) PORTD
#define output 2
void setup () {
pinMode(output, OUTPUT);
}
void loop() {
while (1) {
PORTD = (1<<PD2);
PORTD = 0;
}
}
HW NAPLNO
Arduino naplno (Arduino Day 2015)
Vlastn鱈 shiled
 Roz邸鱈en鱈 klasick箪ch Arduin (Uno, Mega, )
 V箪roba DPS
 CAD SW (Fritzing, Eagle, )
 Knihovna pro shiled
https://github.com/adafruit/Adafruit-Eagle-Library
Arduino naplno (Arduino Day 2015)
Arduino naplno (Arduino Day 2015)
Arduino naplno (Arduino Day 2015)
Arduino naplno (Arduino Day 2015)
Vlastn鱈 Arduino klon
 Minim叩ln鱈 Arduino
 ATmega
 Nap叩jen鱈
 Reset
 Pipojen鱈 k PC
 ISP
Arduino naplno (Arduino Day 2015)
Arduino naplno (Arduino Day 2015)
Arduino naplno (Arduino Day 2015)
Co d叩l
Pokud potebujete asembler, pou転ili jste m叩lo
v箪konn箪 procesor
Kam d叩l?
while (audience.questionAvailable()) {
answer();
}
Serial.println(F( Dkujeme za pozornost));

More Related Content

Arduino naplno (Arduino Day 2015)

Editor's Notes

  • #6: Na sparkfun byl hezk箪 l叩nek https://www.sparkfun.com/news/1771 http://hackaday.com/2015/03/12/arduino-v-arduino-part-ii/
  • #44: Uk叩zka desky