Arduino

Z MediaWiki SPŠ a VOŠ Písek
(Rozdíly mezi verzemi)
Přejít na: navigace, hledání
(Examples)
(What is available...)
 
(Není zobrazeno 88 mezilehlých verzí od 2 uživatelů.)
Řádka 1: Řádka 1:
[[Soubor:Arduino_01.jpg|thumb|Arduino Duemilanove]]
+
{| class="toccolours" cellpadding="5" style="float: right; clear: right; margin: 0 0 1em 1em; font-size: 85%; width: 30em"
[[Soubor:Arduino_02.png|thumb|link=http://arduino.cc/hu/Main/Software|Download SW]]
+
| colspan="2" style="text-align: center; font-size: larger; background-color: lightgreen;" | '''''Arduino '''''
  
 +
|- style="vertical-align: top;"
 +
|
  
Arduino
+
[[Soubor:Kniha_Aruino.cz.png|link=http://arduino.cz/]]
  
* Mikrokontrolér: ATmega168 / ATmega328
+
* Mikrokontrolér: [[AVR]] ATmega168 / ATmega328
 
* Takt procesoru: 16 MHz
 
* Takt procesoru: 16 MHz
 
* Pracovní napětí: 5V (Vstupní napětí (doporučené): 7 až 12V)
 
* Pracovní napětí: 5V (Vstupní napětí (doporučené): 7 až 12V)
Řádka 15: Řádka 17:
 
* EEPROM: 512 bytů (ATmega168) nebo 1 KB (ATmega328)
 
* EEPROM: 512 bytů (ATmega168) nebo 1 KB (ATmega328)
  
==Vývoj MIT aplikace s Arduino:==
+
[[Soubor:Ardiono-day.jpg|link=https://plzenskybarcamp.cz/2015/arduino-day]]
 +
|}
  
=== Jaký HW potřebujeme: ===
+
[[Soubor:Arduino_01.jpg|thumb|Arduino Duemilanove]]
 +
[[Soubor:Arduino_02.png|thumb|link=http://arduino.cc/hu/Main/Software|Download SW]]
 +
[[Soubor:Arduino_04.jpg|thumb|Schéma]]
  
Varianta A:
+
==Vývoj MIT aplikace s Arduino:==
  
 +
=== What we needs: ===
 +
Sestavy:
 
<Gallery>
 
<Gallery>
Soubor:Prevodnik_arduino.jpg|[http://aukro.cz/listing.php/search?sg=0&string=p%C5%99evodn%C3%ADk+%2B+arduino Převodník pro Arduino]
+
Soubor:arduino_KNP.jpg|[https://en.wikipedia.org/wiki/ATmega328 ATmega328] + bootloader [http://uart.cz/452/arduino-na-nepajivem-poli/ Návod] [http://www.xappsoftware.com/wordpress/2012/04/16/how-to-upload-sketches-to-arduino-uno-chip-using-pl2303-usb-to-rs-232-converter/ How to using PL2303]
Soubor:arduino_ATmega328P.jpg|[http://cz.farnell.com/arduino/a000048/mcu-atmega328-w-uno-bootloader/dp/1848694 ATMega328P s bootloaderem] nebo nově na [http://www.gme.cz/znacka/arduino/ GME.cz]
+
Soubor:Arduino_Nanino.jpg|[http://vonkonow.com/wordpress/2012/10/nanino-the-diy-friendly-arduino/ Nanino] + [http://goo.gl/J8zTA7 CP2104 s DTR]  
Soubor:arduino_KNP.jpg|[http://uart.cz/452/arduino-na-nepajivem-poli/ Návod]  
+
Soubor:Atmega328-sch.png
</Gallery>
+
 
+
Varianta B:
+
<Gallery>
+
Soubor:Arduino_deal_ext.jpg|[http://www.dealextreme.com/p/arduino-duemilanove-2009-atmega328-p-20pu-usb-board-blue-60cm-118078?item=25 Arduino Compatible Duemilanove]  
+
Soubor:R8X_Digital.jpg|[http://www.dealextreme.com/p/8x-digital-tube-8x-key-8x-double-color-led-module-81873?item=20 8X Digital Tube + 8X Key + 8X Double Color LED Module]
+
Soubor:lcd-keypad-shield-for-arduino.jpg|[http://www.dealextreme.com/p/lcd-keypad-shield-for-arduino-duemilanove-lcd-1602-118059?item=12 LCD Keypad Shield]  
+
 
+
 
</Gallery>
 
</Gallery>
  
Řádka 42: Řádka 41:
 
*/
 
*/
  
int ledPin = 13;   // LED je připojena na pin 13
+
int ledPin = 13;               // LED je připojena na pin 13
  
void setup() // tato část proběhne jednou po startu
+
void setup(){                  // tato část proběhne jednou po startu
{
+
    pinMode(ledPin, OUTPUT);   // nastaví pin jako výstupní
pinMode(ledPin, OUTPUT); // nastaví pin jako výstupní
+
 
}
 
}
  
void loop()   // tato část probíhá stále dokola
+
void loop(){                      // procedura
{
+
    digitalWrite(ledPin, HIGH);  // rozsvícení LED
digitalWrite(ledPin, HIGH);  // rozsvícení LED
+
    delay(1000);                  // pauza 1s
delay(1000);                  // pauza 1s
+
    digitalWrite(ledPin, LOW);    // zhasnutí LED
digitalWrite(ledPin, LOW);    // zhasnutí LED
+
    delay(1000);                  // pauza 1s
delay(1000);                  // pauza 1s
+
 
}
 
}
 
</source>
 
</source>
  
[[Arduino-Knight Rider]]
+
== Tools: ==
 +
 
 +
<gallery>
 +
Soubor:Arduino_blink.jpg|[http://blog.ardublock.com/ ArduBlock]
 +
Soubor:123d.jpg|[https://www.tinkercad.com/ tinkercad - web Arduino IDE]
 +
Soubor:simulide.jpg|[http://sourceforge.net/projects/simulide/ SimulIDE]
 +
Soubor:Code-Blocks.png|[http://www.arduinodev.com/codeblocks/  CodeBlocks - web Arduino IDE]
 +
Soubor:Codebender.png|[https://codebender.cc/how_it_works  Codebender - web Arduino IDE]
 +
</gallery>
 +
 
 +
*.hex you can find in c:\Users\*\Local Settings\Temp\build*.tmp\*.hex
  
== Tutoriály: ==
+
== Tutorials: ==
 
<gallery>
 
<gallery>
 +
Soubor:Arduino_Comic.jpg|[[Soubor:Icon-pdf.gif]] [http://playground.arduino.cc/uploads/Main/arduino_comic_v0004.pdf Arduino Comic] [http://playground.arduino.cc/uploads/Main/arduino_comic_blank.pdf Blank for CZ]
 +
Soubor:Arduino-itnetwork.png|[http://www.itnetwork.cz/mikrokontroler-arduino-tutorialy Tutorial]
 +
Soubor:Arduino-adafruit.png|[http://learn.adafruit.com/series/learn-arduino LEARN ARDUINO 18 GUIDES]
 +
Soubor:Konstrukce_robota_arduino.jpg|[http://avc.siliconhill.cz/installfest-2013/ Konstrukce a použití Arduino robota (Vladimír Jarý)]
 +
Soubor:Introduction_to_the_Arduino.jpg|[http://www.youtube.com/watch?v=CqrQmQqpHXc An Introduction to the Arduino]
 
Soubor:arduino_tutorial_series_jeremy_blum.jpg|[http://www.jeremyblum.com/portfolio/arduino-tutorial-series/ Arduino Tutorial Series by Jeremy Blum]
 
Soubor:arduino_tutorial_series_jeremy_blum.jpg|[http://www.jeremyblum.com/portfolio/arduino-tutorial-series/ Arduino Tutorial Series by Jeremy Blum]
 
Soubor:arduino_tutorial.jpg|[http://www.ladyada.net/learn/arduino/index.html Arduino Tutorial - Step by Step]
 
Soubor:arduino_tutorial.jpg|[http://www.ladyada.net/learn/arduino/index.html Arduino Tutorial - Step by Step]
Soubor:arduino-blok.png|[http://arduino-blog.cz/?page_id=6 Arduino Blog]
+
Soubor:Arduino_Tutorial_Bundle.jpg|[http://www.instructables.com/id/Arduino-Expermentation-Kit-How-to-get-Started-wi/?ALLSTEPS Arduino Tutorial Bundle]
 
Soubor:Arduino-c.jpg|[http://www.linuxsoft.cz/article.php?id_article=1877 Arduino - programování v čistém C(++)]
 
Soubor:Arduino-c.jpg|[http://www.linuxsoft.cz/article.php?id_article=1877 Arduino - programování v čistém C(++)]
 
Soubor:Arduino-root-cz.jpg|[http://www.root.cz/clanky/arduino-jak-pro-nej-zacit-programovat/ Jak pro něj začít programovat - seriál na ROOT.cz]
 
Soubor:Arduino-root-cz.jpg|[http://www.root.cz/clanky/arduino-jak-pro-nej-zacit-programovat/ Jak pro něj začít programovat - seriál na ROOT.cz]
Řádka 70: Řádka 82:
 
Soubor:arduino-josefnav.jpg|[http://www.josefnav.cz/Arduino.html Popis od Josefa NAV]
 
Soubor:arduino-josefnav.jpg|[http://www.josefnav.cz/Arduino.html Popis od Josefa NAV]
 
Soubor:arduinocheatsheet.png|[http://sites.google.com/site/mechatronicsguy/arduinocheatsheet download]
 
Soubor:arduinocheatsheet.png|[http://sites.google.com/site/mechatronicsguy/arduinocheatsheet download]
 +
Soubor:arduino-playground.jpg| [http://playground.arduino.cc/Code/BitMath#binary Bit Math Tutorial by CosineKitty]
 +
Soubor:arduino-wiring-ledswing.jpg| [http://wiring.org.co/learning/basics/ledswing.html Learning with Wiring -LEDSwing]
 
</gallery>
 
</gallery>
  
==Aplikace:==
+
== Aplikace s Arduino ==
  
<gallery>
+
{{Zajímavá zapojení s Arduino}}
Soubor:Arduino-settings-LED.jpg|[http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard Setting up an Arduino on a breadboard]
+
Soubor:blikani-LED.jpg|[http://www.techdot.eu/index.php/2008/02/01/arduino-prvni-program-blikani-led/ Arduino: První program - blikání LED] [http://www.instructables.com/id/Arduino-Examples-1-Make-An-RGB-Led-Randomly-Flash/ Arduino Examples #1]
+
Soubor:Arduino-Knight-rider.jpg|[http://old.pavel-novak.net/clanky/arduino-knight-rider.html Knight rider]
+
Soubor:Arduino-traffic-light.jpg|[http://fritzing.org/projects/traffic-light-with-stop-request/ TRAFFIC LIGHT WITH STOP REQUEST]
+
Soubor:Arduino-74HC164.jpg|[http://www.instructables.com/id/The-74HC164-Shift-Register-and-your-Arduino/?ALLSTEPS The 74HC164 Shift Register and your Arduino]
+
Soubor:Arduino-4094.jpg|[http://www.buildcircuit.com/decimal-to-binary-converter-using-cd4094-android-phone-and-bluesmirf/ Decimal To Binary Converter Using CD4094]
+
Soubor:Arduino-74HC595v3.jpg|[http://arduino.cc/en/Tutorial/ShiftOut Serial to Parallel Shifting-Out with a 74HC595]
+
Soubor:Arduino-74HC595.jpg|[http://fritzing.org/projects/nightrider-with-arduino-16-leds-and-two-74hc595/ KNIGHTRIDER WITH ARDUINO, 16 LEDS AND TWO 74HC595]
+
Soubor:Arduino-74HC595v2.jpg|[http://fritzing.org/projects/arduino-shift-register-larson-scanner/ ARDUINO SHIFT REGISTER LARSON SCANNER]
+
Soubor:Arduino-74HC595v4.jpg|[http://www.protostack.com/blog/2010/05/introduction-to-74hc595-shift-register-controlling-16-leds/ Introduction to 74HC595 shift register – Controlling 16 LEDs]
+
Soubor:Arduino-7SegmentLED2.jpg|[http://blog.bsoares.com.br/arduino/cpp-class-for-controlling-7-segments-led-display Classe C++ para controlar Display de 7 seguimentos]
+
Soubor:Arduino-7SegmentLED.jpg|[http://www.hacktronics.com/Tutorials/arduino-and-7-segment-led.html Arduino and 7 Segment LED]
+
Soubor:Arduino-4-Digit-7-Segment-LED.jpg|[http://www.instructables.com/id/4-Digit-7-Segment-LED-Display-Arduino/ 4-Digit 7-Segment LED Display + Arduino]
+
Soubor:Arduino-4511-dec.jpg|[http://nzlamb.wordpress.com/2010/01/30/simple-arduino-7-segment-display-example/ Simple Arduino 7 segment display example with 4511 LED decoder]
+
Soubor:Arduino-74HC595-Shift-Register.jpg|[http://www.sweeting.org/mark/blog/2011/11/27/arduino-74hc595-shift-register-and-a-7-segment-led-display 74HC595 Shift Register]
+
Soubor:Arduino-TM1638-LED-Display.jpg|[http://tronixstuff.wordpress.com/2012/03/11/arduino-and-tm1638-led-display-modules/ TM1638 LED Display Modules] [http://www.martinhubacek.cz/atmel/tm1638-driver MH]
+
Soubor:Arduino-buzzer.jpg|[http://www.instructables.com/id/Play-the-French-Can-Can-Using-an-Arduino-and-Buzze/?ALLSTEPS Buzzer]
+
Soubor:Arduino-L293.jpg|[http://letsmakerobots.com/node/2074 Control your motors with L293D]
+
Soubor:arduino_dc_motor.jpg|[http://luckylarry.co.uk/arduino-projects/control-a-dc-motor-with-arduino-and-l293d-chip/ Control a DC motor with Arduino and L293D chip]
+
Soubor:Arduino-LCD.png|[http://www.arduino.cc/en/Tutorial/LiquidCrystal LCD displays HD44780]
+
Soubor:Arduino-a-LCD-s-S6A0069-radicem.png|[http://blog.tomasbrincil.cz/?p=283 Arduino a LCD s S6A0069 řadičem]
+
Soubor:Arduino-web-camera.jpg|[http://blog.tomasbrincil.cz/?cat=20 Arduinem ovládaná webkamera streamující video přes VLC #2]
+
Soubor:How-to-Make-LEDs-Flash-to-Music-with-an-Arduino.jpg|[http://www.instructables.com/id/How-to-Make-LEDs-Flash-to-Music-with-an-Arduino/ How to Make LEDs Flash to Music with an Arduino]
+
Soubor:arduino-distance-sensor-ping.jpg|[http://mattwiechec.wordpress.com/2010/01/26/arduino-distance-sensor-ping/ Arduino – Distance Sensor PING)))]
+
Soubor:arduino_MPX_display.jpg|[http://translate.google.co.jp/translate?js=y&prev=_t&hl=ja&ie=UTF-8&layout=1&eotf=1&u=http://arms22.blog91.fc2.com/blog-entry-365.html&sl=ja&tl=en&swap=1 Display the fan speed for the PC]
+
Soubor:AVR-cube_8x8.jpg|AVR19 [http://www.instructables.com/id/Led-Cube-8x8x8/?ALLSTEPS Building] [http://www.pyroelectro.com/projects/8x8x8_led_cube/index.html SW]
+
Soubor:nathan_arduino.jpg|[http://nathan.chantrell.net/arduino/ nathan.chantrell.net]
+
Soubor:matrix_arduino-AS1106.jpg|[http://arduinoexamples.wordpress.com/2012/11/05/dedicated-ic-to-control-7-segment-display-drivers-for-7-segment/ Popis][http://www.spezial.cz/news/as1106-8-mistny-seriove-rizeny-led-driver.html popis AS1106] [http://www.elsniwiki.de/index.php/Main/ArduinoLedMatrix Ansteuern einer 8x8 LED-Matrix mit dem Arduino]
+
Soubor:matrix_arduino.jpg|[http://www.pjrc.com/teensy/td_libs_Matrix.html Matrix & Sprite Libraries]
+
Soubor:matrix_LED_arduino.jpg|[http://www.instructables.com/id/Arduino-8x8-Matrix-LED-Game/?ALLSTEPS Arduino 8x8 Matrix LED Game]
+
Soubor:Arduino-RGB-LED-Controller.jpg|[http://blog.tkjelectronics.dk/2011/08/arduino-rgb-led-controller/#more-1347 Arduino RGB LED Controller]
+
Soubor:Arduino-RFID-Door-Lock.jpg|[http://blog.tkjelectronics.dk/2011/04/arduino-rfid-door-lock/#cut-1 Arduino RFID Door Lock]
+
  
</gallery>
+
== Videa ==
  
==Doplňky:==
+
{{#widget:YouTube|id=o0GyeYBJ4QM|height=160|width=240|link=http://www.x-sim.de/forum/viewtopic.php?f=40&t=155}}
 +
{{#widget:YouTube|id=azfPoXOmKog|height=160|width=240|link=http://www.buildcircuit.com/decimal-to-binary-converter-using-cd4094-android-phone-and-bluesmirf/}}
 +
{{#widget:YouTube|id=2HOJjt19-sE|height=160|width=240}}
  
<gallery>
+
== Experimenty ==
  
Soubor:Arduino_deal.jpg|[http://www.dealextreme.com/p/multi-function-4wd-arduino-robot-raider-car-kits-128715?item=28 Arduino Robot Car Kits]
 
  
Soubor:propoj_kabel.jpg|[http://www.avratmel.eu Propojovací kablíky]  
+
<Gallery>
 +
Soubor:arduino fotka.jpg|[[Arduino - Compatible 8X Seven Segments Display|Compatible 8X Seven Segments Display]]
 +
Soubor:Arduiono-robot-pepik.jpg|[[Arduino - Jednoduchá aplikace|Jednoduchá aplikace - Robot Pepík - učebna D10]]
 +
Soubor:arduino-spsavos.jpg|[[Arduino - pohybující text: SPS a VOS|Pohybující text: SPS a VOS Pisek]]
  
Soubor:8-LED.jpg|[http://dx.com/p/8-led-red-light-strip-microcontroller-module-green-red-150330 8-LED CZ 70]
+
Soubor:arduino-pocitadlo.jpg|[[Arduino - datumové počítadlo|Počítadlo: roky - měsíce - dny - hodiny - minuty - sekundy]]
 +
</Gallery>
  
Soubor:8-Segment_LED.jpg|[http://dx.com/p/8-segment-led-display-board-module-for-arduino-147814 8-Segment LED CZK 112]
 
  
Soubor:8-Segment_LED2.jpg|[http://dx.com/p/8-segment-led-display-board-module-for-arduino-147814 8-Segment LED CZK 95]
+
== Arduino Shield by SPŠ ==
  
Soubor:dot-matrix-display.jpg|[http://dx.com/p/diy-max7219-dot-matrix-display-module-for-arduino-green-151840 Matrix display CZK 134]
+
<Gallery>
 +
Soubor:arduino_shield_UNI.jpg
 +
</Gallery>
  
Soubor:PL2303HX.jpg|[http://dx.com/p/pl2303hx-usb-to-ttl-converter-module-149859%20PL2303HX%20USB%20to%20TTL%20Converter%20Module CZK 66]
+
== www ==
  
Soubor:ht1632c.jpg|[http://dx.com/p/jy-mcu-3208-lattice-clock-ht1632c-driver-with-mcu-support-secondary-development-104306 Clock HT1632C CZ 236]
+
[http://uart.cz/394/arduino-a-usb/ Arduino a USB]
</gallery>
+
  
== Videa ==
+
[[Soubor:Pdf.jpg]] [http://robodoupe.cz/wp-content/uploads/2013/04/Arduino-a-PICAXE-na-Windows-8-64.pdf Arduino a PICAXE na Windows 8 64-bit]
  
{{#widget:YouTube|id=o0GyeYBJ4QM|height=160|width=240|link=http://www.x-sim.de/forum/viewtopic.php?f=40&t=155}}
+
[[Kategorie:SW]]
{{#widget:YouTube|id=azfPoXOmKog|height=160|width=240|link=http://www.buildcircuit.com/decimal-to-binary-converter-using-cd4094-android-phone-and-bluesmirf/}}
+
[[Kategorie:HW]]
 +
[[Kategorie:MIT]]
  
  
===Buzzer:===  
+
== advance ==
  
[http://www.instructables.com/id/Play-the-French-Can-Can-Using-an-Arduino-and-Buzze/?ALLSTEPS source]
+
[http://achuwilson.wordpress.com/2011/12/15/arduino-ide-for-programming-atmega-microcontrollers/ Arduino IDE for programming Atmega Microcontrollers]
<source lang"C">
+
// Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
+
// by Rob Faludi
+
// http://www.faludi.com
+
  
void setup() {
+
[http://tutorial.cytron.com.my/2011/09/30/how-to-program-arduino-by-using-avr-usbasp-programmer/ How to program Arduino by using USBasp without bootloader]
  pinMode(4, OUTPUT); // set a pin for buzzer output
+
}
+
  
void loop() {
+
[http://www.arduino.cc/en/Main/Standalone Building an Arduino on a Breadboard]
  buzz(4, 2500, 500); // buzz the buzzer on pin 4 at 2500Hz for 1000 milliseconds
+
  delay(1000); // wait a bit between buzzes
+
}
+
  
void buzz(int targetPin, long frequency, long length) {
+
[http://www.virtualbreadboard.com/Main.aspx?TAB=4&doc=Tutorials/Arduino/Import%20Arduino%20Sketches/Import%20Arduino%20Sketches Virtual Breadboard]
  long delayValue = 1000000/frequency/2; // calculate the delay value between transitions
+
  //// 1 second's worth of microseconds, divided by the frequency, then split in half since
+
  //// there are two phases to each cycle
+
  long numCycles = frequency * length/ 1000; // calculate the number of cycles for proper timing
+
  //// multiply frequency, which is really cycles per second, by the number of seconds to
+
  //// get the total number of cycles to produce
+
for (long i=0; i < numCycles; i++){ // for the calculated length of time...
+
    digitalWrite(targetPin,HIGH); // write the buzzer pin high to push out the diaphram
+
    delayMicroseconds(delayValue); // wait for the calculated delay value
+
    digitalWrite(targetPin,LOW); // write the buzzer pin low to pull back the diaphram
+
    delayMicroseconds(delayValue); // wait againf or the calculated delay value
+
  }
+
}
+
  
</source>
+
[http://arduinodiy.wordpress.com/2012/03/19/serial-connection-for-your-arduino-atmega/ Serial connection for your Arduino / Atmega]
  
===Jednoduchá aplikace pro Arduino:===
+
[http://www.electrodragon.com/w/DIY_Arduino#Basic_Minimal_Arduino_Without_Crystal Basic Minimal Arduino Without Crystal]
+
  
<source lang"C">
+
[http://todbot.com/blog/2009/05/26/minimal-arduino-with-atmega8/ Minimal Arduino with ATmega8]
/*
+
* Robot Pepík - učebna D10
+
* Tento program zobrazuje čas, který uběhl od spuštění programu 
+
* - při každé 0té sekundě popojede dopředu 
+
* - při každé první sekundě se zastaví   
+
* - při každé desáté sekundě popojede zpět 
+
* - při každé jedenácté sekundě se zastaví     
+
*/  
+
  
// přiložení knihovny pro práci s LCD 
+
[http://www.instructables.com/id/Burning-the-Bootloader-on-ATMega328-using-Arduino-/?ALLSTEPS Burning the Bootloader on ATMega328 using Arduino UNO as ISP]
#include <LiquidCrystal.h> 
+
  
// inicializace LCD - nastavení používaných pinů
+
[http://www.instructables.com/id/USBASP-Bootloading-a-ATMega328p-with-a-8mhZ-intern/?ALLSTEPS USBASP Bootloading a ATMega328p with a 8MHz internal clock]
LiquidCrystal lcd(11, 9, 5, 4, 3, 2);   
+
  
//inicializace portů DC Motorů 
+
[http://www.instructables.com/id/Make-your-own-arduino-serverino/?ALLSTEPS Make your own arduino serverino]
int motor_left[] = {6, 7}; 
+
// pole obsahující ovládací piny levého motoru 
+
int motor_right[] = {8, 10}; // pole obsahující ovládací piny pravého motoru  void setup() {  //DC motory - počáteční nastavení   
+
  
int i;  for(i = 0; i < 2; i++){
+
[https://www.youtube.com/watch?v=3imfP2TZbNc Arduino Voice Control using Smartphone]
  pinMode(motor_left[i], OUTPUT); 
+
  pinMode(motor_right[i], OUTPUT);
+
  }   
+
  
lcd.begin(16, 2);  // nastavení rozsahu LCD monitoru 
+
== Shield ==
   
+
[[Soubor:How to Build the LOL Shield Kit.jpg|link=http://www.youtube.com/watch?v=FVRrOtP1Dvk|thumb|How to Build the LOL Shield Kit]]
lcd.setCursor(0, 0);  // nastavení kurzoru na LCD na pozici 0:0   
+
LoL Shield věnovaný sponzorem školy: [http://aukro.cz/listing/user.php?us_id=23961189 jitenkaa], (zde je možné stavebnici objednat)
lcd.print("Minuty:");  // vytiskne text na LCD   
+
  
lcd.setCursor(0, 1);  // nastavení kurzoru na LCD na pozici 0:0   
+
{{#widget:YouTube|id=sWpqH37Zb9M|height=360|width=480|LoL Shield od sponzora jitenkaa|centre}}  
lcd.print("Sekundy:"); // vytiskne text na LCD   
+
}  
+
  
void loop() {  // tato funkce se neustále opakuje 
+
<gallery>
  int sekundy = (millis()/1000);  // zjištění a výpočet doby, od spuštění programu - v sekundách
+
Soubor:Arduino_4WD_robot-smart.jpg|[http://goo.gl/YOGRFI 4WD Robot Smart Car Chassis Kits]
  int minuty = millis()/1000/60;  // zjištění a výpočet doby, od spuštění programu - v minutách
+
Soubor:Arduino_deal.jpg|[http://goo.gl/bzhxD9 Arduino Robot Car Kits]
  sekundy -= minuty*60;  // korekce času - po 60ti sekundách se sekundy vynulují 
+
Soubor:CP2104.jpg|[http://goo.gl/U4ajVi|USB CP2104 TTL]
  if(sekundy == 0)  // když se sekundy rovnají 0, display se vymaže
+
Soubor:6bit-Chartreuse-LED-Arduino.jpg|[http://goo.gl/yE4oyM 6bit Chartreuse LED for Arduino]
    { 
+
Soubor:8-LED.jpg|[http://goo.gl/cnKXhz 8 Channels Flowing Water Light LED]
    lcd.setCursor(10, 0);
+
    lcd.print("    ");
+
  
    lcd.setCursor(10, 1);
+
Soubor:ht1632c.jpg|[https://www.instructables.com/User-Manual-MAX7219-Dot-Matrix-4-in-1/ MAX7219 Matrix Display]
    lcd.print("    ");
+
  
    drive_forward(); // v nulté sekundě se motor vždy rozjede dopředu
 
    }
 
  
  lcd.setCursor(10, 0);  // nastaví pozici kurzoru na LCD
+
</gallery>
  lcd.print(minuty);    // vytiskne čas, který uběhl od spuštění programu v minutách
+
  
  if(sekundy==1)  // v první sekundě se motor vždy zastavý
+
=== What is available... ===
    {
+
    motor_stop();
+
    }
+
  if(sekundy == 10) // v desáté sekundě se motor vždy rozjede dozadu
+
    {
+
    drive_backward();
+
    }
+
  if(sekundy == 11) // v jedenácté sekundě se motor vždy zastavý
+
    {
+
    motor_stop();
+
    }
+
  
    lcd.setCursor(10, 1);
+
<gallery>
    lcd.print(sekundy);    // vytiskne čas, který uběhl od spuštění programu v sekundách
+
Soubor:Multifunctional Expansion Board.png|[[:Soubor:MFEB-schematic.png|schéma]] [[:Soubor:MFEB-example.pdf|příklady]]
    }
+
Soubor:Arduino-Ethernet.jpg|[http://arduino.cc/en/Main/ArduinoEthernetShield Arduino Ethernet Shield W5100 + microSD]|[http://arduino.cc/en/Reference/Ethernet knihovna]
 +
Soubor:USB_UART_TTL_CH340.png|USB převodník UART TTL s čipem CH340
 +
Soubor:Bluetooth_modul_HC-06.png|[http://www.rasmicro.com/Bluetooth/EGBT-045MS-046S%20Bluetooth%20Module%20Manual%20rev%201r0.pdf Modul HC-06 Bluetooth] [http://goo.gl/aWFkIi Bluetooth Transceiver Module] [http://www.buildcircuit.com/decimal-to-binary-converter-using-cd4094-android-phone-and-bluesmirf/ aplikace]
  
  void motor_stop(){      //zastaví DC motory
+
Soubor:dot-matrix-display.jpg|[http://arduino-er.blogspot.cz/2015/01/arduino-uno-spi-8x8-led-matrix-with.html 8x8 LED Matrix with MAX7219]
  digitalWrite(motor_left[0], LOW);
+
Soubor:R8X_Digital.jpg|[http://goo.gl/LxJdXJ 8-Bit Double Color LED TM1638 Arduino]
  digitalWrite(motor_left[1], LOW);
+
  
  digitalWrite(motor_right[0], LOW);
+
Soubor:lcd-keypad-shield-for-arduino.jpg|[http://goo.gl/dTfeHv LCD Keypad Shield]  
  digitalWrite(motor_right[1], LOW);
+
Soubor:IIC-Serial-Interface-LCD.jpg|[http://goo.gl/OZYx1x IIC/I2C/TWI/SPI Serial Interface Arduino 1602LCD]
  delay(25);
+
  }   
+
  
  void drive_forward(){    //zapne DC motory směrem dopředu
+
Soubor:Arduino-Clock-Shield.jpg|[http://goo.gl/YGz6ZT RTC TM1636 DS1307] [http://www.seeedstudio.com/wiki/Tick_Tock_Shield_Kit Clock Datalogger  Shield Wire Digital Module RTC TM1636 DS1307]
  digitalWrite(motor_left[0], HIGH);
+
  digitalWrite(motor_left[1], LOW);
+
  
  digitalWrite(motor_right[0], HIGH);
+
Soubor:RTC-Arduino.jpg|[http://goo.gl/4xY2Ny RTC DS1307 I2C AT24C32 Arduino]
  digitalWrite(motor_right[1], LOW);
+
  }
+
  
  void drive_backward(){    //zapne DC motory směrem vzad
+
Soubor:ISD1820-Voice-Board.jpg|[http://goo.gl/iob0l6 ISD1820 Voice Board]
  digitalWrite(motor_left[0], LOW);
+
  digitalWrite(motor_left[1], HIGH);
+
  
  digitalWrite(motor_right[0], LOW);
+
Soubor:Arduino-Stepper-Motor-ULN2003.jpg|[http://goo.gl/YtQEAv 2X DC 5V Stepper Motor + ULN2003 Driver Test Module Board 28BYJ-48 for Arduino]
  digitalWrite(motor_right[1], HIGH);
+
Soubor:Motor-drive-L293D.jpg|[http://goo.gl/blES3Y Motor Drive Shield Expansion Board L293D]
  }
+
Soubor:RC522-Mifare-RFID.png|[http://playground.arduino.cc/Learning/MFRC522 Mifare MFRC522 RFID Reader/Writer]
 +
Soubor:HC-SR04-ultrasonic.png|HC-SR04 Ultrazvukový senzor-ultrasonic
  
  void turn_left(){    //zapne DC motory a zatočí vlevo
+
Soubor:DHT11 _1113.png|[http://www.micro4you.com/files/sensor/DHT11.pdf Arduino senzor vlhkosti a teploty DHT11]
  digitalWrite(motor_left[0], LOW);
+
  digitalWrite(motor_left[1], HIGH);
+
  
  digitalWrite(motor_right[0], HIGH);
+
Soubor:Modul_4x7seg_display_TM1637.png|[http://mcustore.cz/products/300904/TM1637_sch.png Modul 4x7seg display TM1637]|[http://robotstore.cz/wp-content/uploads/2014/01/4-Digit-Display-v0.9b%E5%8E%9F%E7%90%86%E5%9B%BE.pdf]|[http://www.titanmec.com/doce/product-detail-396.html Datasheet]|[http://mcustore.cz/products/300904/DigitalTube.zip DigitalTube]|[http://mcustore.cz/products/300904/TimerOne-r11.zip TimerOne]|[http://robotstore.cz/wp-content/uploads/2014/01/DigitalTubeforArduino1.0+.rar Příklady]
  digitalWrite(motor_right[1], LOW);
+
  }
+
  
  void turn_right(){    //zapne DC motory a zatočí vpravo
+
Soubor:Cidlo_teploty_a_vlhkosti_DHT22_AM2302.png|[http://mcustore.cz/products/102005/DHT22.pdf Čidlo teploty a vlhkosti DHT22]
  digitalWrite(motor_left[0], HIGH);
+
Soubor:Membranova_klavesnice_4x3.png|Membránová klávesnice 4x3 Slim
  digitalWrite(motor_left[1], LOW);
+
Soubor:Modul_pro_SD_karty.png|[http://mcustore.cz/products/300207/sdcard_sch.jpg Modul pro SD karty]
 +
Soubor:Mini_SD_AD4_Audio.png|[http://www.buildcircuit.com/example-1-using-wtv020sd-16p-music-module-with-arduino/ Mini SD AD4 Audio Přehrávač]
  
  digitalWrite(motor_right[0], LOW);
+
Soubor:Adresovatelna_RGB_LED_5V_SMD.png|[http://www.instructables.com/id/Best-RGB-LEDs-for-any-project-WS2812/?ALLSTEPS Adresovatelná RGB LED 5V SMD WS2812]  
  digitalWrite(motor_right[1], HIGH);
+
Soubor:Adresovatelna_RGB_deska_3xLED_12V.png|[http://www.adafruit.com/datasheets/WS2811.pdf Adresovatelná_RGB deska 3xLED 12V WS2811]
  }
+
Soubor:Arduino_gyroskop_akcelerometr.png|[http://invensense.com/mems/gyro/documents/PS-MPU-6000A.pdf Gyroskop akcelerometr MPU-6050 I2C]
</source>
+
Soubor:digitalni_kompas_HMC5883L.png|[http://www51.honeywell.com/aero/common/documents/myaerospacecatalog-documents/Defense_Brochures-documents/HMC5883L_3-Axis_Digital_Compass_IC.pdf 3-osý digitální kompas HMC5883L]
 +
Soubor:L298N_Arduino_DC_Motor_H-Mustek.png|L298N Arduino Duální Řadič DC Motor H-Můstek
 +
Soubor:Sensor_Shield_V5.png|Sensor Shield V5
 +
Soubor:Matrix8x8-Arduino.png|[http://www.gme.cz/led-display-maticovy-32x32mm-rg-hd-m10eg88md-p512-178 GME.cz] [http://arduino-er.blogspot.cz/2015/02/beating-heart-animation-on-8x8-led.html 8x8 LED Matrix] [http://www.instructables.com/id/Intermediate-Arduino-Inputs-and-Outputs/?ALLSTEPS]
 +
Soubor:RGB-LED.png|RGB LED Strip
 +
Soubor:Arduino-Full-Color-RGB.jpg|[https://www.instructables.com/LED-Multiplexing-101-6-and-16-RGB-LEDs-With-Just-a/ Full Color RGB 8-SMD 5050 LED Module]
 +
Soubor:WeMOS D1.png|[http://educ8s.tv/esp8266-ota-wemos-d1/ WeMOS D1]
 +
Soubor:MEMSIC_2125.png|[https://www.parallax.com/product/28017 MEMSIC 2125 Dual-axis Accelerometer]
 +
Soubor:H48C.png|[https://itp.nyu.edu/archive/physcomp-spring2014/sensors/Reports/H48C.html H48C - 3 Axis Accelerometer]
 +
Soubor:ACS712.png|[https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ Proudový senzor 30A ACS712]
 +
</gallery>
  
== Arduino Compatible 8X Seven Segments Display ==
+
=== Examples 2 ===
  
 +
# LED bliká v Morseově abecedě SOS ( . . . - - - . . . ) s opakováním s časovým odstupem 4 sekundy
 +
# 8 LED bliká dle pravdivostní tabulky tak, aby svítala v daném čase postupně jen jedna LED (had)
 +
# Aktivací tlačítka LED, která předtím svítila zhasne
 +
# Každým zmáčknutím tlačítka se změní stav LED na opačný
 +
# Jedním tlačítkem LED zhasne a jiným se rozsvítí
  
[[Soubor:Arduiono-7disp.jpg|300px]] [[Soubor:arduino fotka.jpg|300px]]
+
==== Test tlačítka ====
 +
[[Soubor:Button-LED.png|200px|right]]
  
Integrovaná tlačítka, LED & 7 segmentový display
+
<source lang"Csharp">
- Vyžaduje pouze 3 IO výstupy k činnosti
+
void setup()
- TM1638 chip micro-8 8-segment LED displayů a 8 tlačítek a 8 testovacíhc dvoubarevných Led kontrolek, IO zajišťují sériovou komunikaci rozhraní, 8 nastavovacích úrovní jasu.
+
{
Specifikace: 0.2 cm x 5.0 cm x 1.0 cm
+
  pinMode( 2, INPUT_PULLUP);
 
+
  pinMode( 8, OUTPUT);
Programuje se v progamu Arduino pomoc jazyka C++ (možno sáhnout zde http://arduino.cc/en/Main/Software). V programu Arduino můžete také načíst funkční příklady z knihovny (možno stáhnout zde http://code.google.com/p/tm1638-library/)
+
}
 
+
'''Příklad pro funkční modul'''
+
void loop()
<source lang"C">
+
{
#include <TM1638.h>
+
  digitalWrite( 8 , !digitalRead(2) );
#include <InvertedTM1638.h>
+
}
 
+
</source>
#define NO_MODULES  2
+
  
// define a regular module and a inverted module
+
<source lang"Csharp">
TM1638 module1(3, 2, 4);
+
const int buttonPin = 2;     //
InvertedTM1638 module2(3, 2, 5);
+
const int ledPin = 8;     //
TM1638* modules[NO_MODULES] = {
+
  &module1,
+
  &module2
+
};
+
byte modes[NO_MODULES];
+
  
unsigned long startTime;
+
int buttonState = 0;         // variable
  
 
void setup() {
 
void setup() {
   startTime = millis();
+
   pinMode(ledPin, OUTPUT);
    
+
   pinMode(buttonPin, INPUT);
  for (int i = 0; i < NO_MODULES; i++) {
+
    modules[i]->setupDisplay(true, 7);
+
    modes[i] = 0;
+
  }
+
 
}
 
}
  
void update(TM1638* module, byte* mode) {
+
void loop() {
   byte buttons = module->getButtons();
+
   buttonState = digitalRead(buttonPin);
  unsigned long runningSecs = (millis() - startTime) / 1000;
+
   if (buttonState == HIGH) {
 
+
     digitalWrite(ledPin, HIGH);
  // button pressed - change mode
+
   if (buttons != 0) {
+
     *mode = buttons >> 1;
+
    module->clearDisplay();
+
    module->setLEDs(0);
+
 
   }
 
   }
 +
  else {
 +
    digitalWrite(ledPin, LOW);
 +
  }
 +
}
 +
</source>
  
  switch (*mode) {
+
==== Traffic light ====
    case 0:
+
      module->setDisplayToDecNumber(runningSecs, 1 << 7);
+
      break;
+
    case 1:
+
      module->setDisplayToDecNumber(runningSecs, 1 << 6, false);
+
      break;
+
    case 2:
+
      module->setDisplayToHexNumber(runningSecs, 1 << 5);
+
      break;
+
    case 4:
+
      module->setDisplayToHexNumber(runningSecs, 1 << 4, false);
+
      break;
+
    case 8:
+
      module->setDisplayToBinNumber(runningSecs, 1 << 3);
+
      break;
+
    case 16:
+
      module->clearDisplayDigit((runningSecs - 1) % 8, 0);
+
      module->setDisplayDigit(runningSecs % 8, runningSecs % 8, 0);
+
      break;
+
    case 32:
+
      char s[8];
+
      sprintf(s, "Secs %03d", runningSecs % 999);
+
      module->setDisplayToString(s);
+
      break;
+
    case 64:
+
      if (runningSecs % 2 == 0) {
+
        module->setDisplayToString("TM1638  ");
+
      } else {
+
        module->setDisplayToString("LIBRARY ");
+
      }
+
  
      module->setLED(0, (runningSecs - 1) % 8);
+
[[Soubor:Test-traffic-light.png|200px|right]]
      module->setLED(1 + runningSecs % 3, runningSecs % 8);
+
<source lang="csharp">
      break;
+
int pin;
    case 65:
+
      module->setDisplayToError();
+
      break;
+
  
  }
+
void setup() {
 +
      for (int i=4; i <= 13; i++){
 +
        pinMode(i, OUTPUT);
 +
  }
 
}
 
}
  
void loop() {
+
void blik(int pin)
  for (int i = 0; i < NO_MODULES; i++) {
+
{
    update(modules[i], &modes[i]);
+
        digitalWrite(pin, LOW);
  }
+
        delay(500);
 +
        digitalWrite(pin, HIGH);
 +
}
 +
 
 +
void loop()
 +
{
 +
      for (int i=4; i <= 13; i++){
 +
        blik(i);
 +
  }
 
}
 
}
  
 
</source>
 
</source>
'''Jednoduchý příklad pro jedno Arduino'''
 
<source lang"C">
 
#include <TM1638.h>
 
  
// define a module on data pin 3, clock pin 2 and strobe pin 4
+
==== DC motor ====
TM1638 module(3, 2, 4);
+
  
void setup() {
+
[[Soubor:L298N_Arduino_DC_Motor_H-Mustek.png|200px|right]]
  // display a hexadecimal number and set the left 4 dots
+
<source lang="csharp">
  module.setDisplayToHexNumber(0x1234ABCD, 0xF0);
+
int MotorL1 = 3;  
}
+
int MotorL2 = 11;
 +
int MotorR1 = 5;
 +
int MotorR2 = 6;
  
 
void loop() {
 
void loop() {
   byte keys = module.getButtons();
+
   MotorForward();            
 
+
   delay(2000);             
   // light the first 4 red LEDs and the last 4 green LEDs as the buttons are pressed
+
   TurnLeft();
   module.setLEDs(((keys & 0xF0) << 8) | (keys & 0xF));
+
  delay(2000);            
 
}
 
}
 +
 +
void MotorForward() {
 +
  digitalWrite(MotorL1, LOW);  //
 +
  digitalWrite(MotorL2, HIGH);  //
 +
  digitalWrite(MotorR1, LOW);  //
 +
  digitalWrite(MotorR2, HIGH);  //
 +
}
 +
 
 +
void TurnLeft() {
 +
  analogWrite(MotorL1, LOW);  //
 +
  analogWrite(MotorL2, 128);  //
 +
  analogWrite(MotorR1, 128);  //
 +
  digitalWrite(MotorR2, LOW);  //
 +
}
 
</source>
 
</source>
  
'''Příklad pro pohybující se text'''- zde se bude psát SPS A VOS PISEK, napís lze změnit jedoduchým přepsaním textu, rychlost pohybu textu určuje delay
+
==== RGB ====
<source lang"C">
+
#include <TM1638.h>
+
  
#define MODULES 4
+
[[Soubor:RGB-LED.png|200px|right]]
  
// define a modules
+
<source lang="csharp">
TM1638 modules[] = {
+
.....
TM1638(3, 2, 4),
+
TM1638(3, 2, 5),
+
TM1638(8, 9, 5),
+
TM1638(8, 9, 4)
+
};
+
  
void setup() {
+
void loop()
 +
{
 +
  setColor(255, 0, 0);  // red
 +
  delay(1000);
 +
  setColor(0, 255, 0);  // green
 +
  delay(1000);
 +
  setColor(0, 0, 255);  // blue
 +
  delay(1000);
 +
  setColor(255, 255, 0);  // red + green
 +
  delay(1000); 
 +
  setColor(255, 0, 255);  // red + blue
 +
  delay(1000);
 +
  setColor(0, 255, 255);  // green + blue
 +
  delay(1000);
 +
}
 +
 +
void setColor(int red, int green, int blue)
 +
{
 +
  analogWrite(redPin, red);
 +
  analogWrite(greenPin, green);
 +
  analogWrite(bluePin, blue); 
 
}
 
}
  
const char string[] = "      SPS A VOS PISEK        ";
+
</source>
int base = 0;
+
  
void loop() {
+
==== SR04 ultrasonic ====
  for (int i = 0; i < MODULES; i++) {
+
    const char* pos = string + base + (i * 8);
+
  
    if (pos >= string && pos + 8 < string + sizeof(string)) {
+
[[Soubor:HC-SR04-ultrasonic.png|200px|right]]
      modules[i].setDisplayToString(pos);
+
    } else {
+
      modules[i].clearDisplay();
+
    }
+
  }
+
  
  base++;
+
<source lang="Csharp">
 +
#define trigPin 8
 +
#define echoPin 9
  
  if (base == sizeof(string) - 8) {
+
void setup() {
    base = -MODULES * 8;
+
  Serial.begin (9600);
   }
+
   pinMode(trigPin, OUTPUT);
 
+
   pinMode(echoPin, INPUT);
   delay(300);
+
 
}
 
}
  
 +
void loop() {
 +
  long duration, distance;
 +
  digitalWrite(trigPin, LOW); 
 +
  delayMicroseconds(2); //
 +
  digitalWrite(trigPin, HIGH);
 +
  delayMicroseconds(10); //
 +
  digitalWrite(trigPin, LOW);
 +
  duration = pulseIn(echoPin, HIGH);
 +
  distance = (duration/2) / 29.1;
 +
 +
  Serial.print(distance);
 +
  Serial.println(" cm");
 +
  delay(500);
 +
}
 
</source>
 
</source>
'''Příklad pro dva Displaye'''
 
<source lang"C">
 
#include "TM1638.h"
 
  
// hello segments for display
+
==== Servo ====
const byte hello[] = {
+
  0b00000000, 0b01110110, 0b01111001, 0b00111000, 0b00111000, 0b00111111, 0b00000000, 0b00000000
+
};
+
  
// define the first module
+
[[Soubor:servo.png|200px|right]]
TM1638 module1(3, 2, 4);
+
<source lang"Csharp">
// to chain modules, use the same clk and data - just specify a different strobe pin
+
#include <Servo.h>
TM1638 module2(3, 2, 5);
+
  
unsigned long value = 0L;
+
Servo myservo;
boolean state = true;
+
  
void setup()
+
int pos = 0;  
{
+
  // display the hello segments on module 1
+
  module1.setDisplay(hello);
+
  // display the hello segments on module 2
+
  module2.setDisplay(hello);
+
  
   // light the lower 5 red LEDs and the top 5 green LEDs
+
void setup() {
   module1.setLEDs(0b00011111 | 0b11111000 << 8);
+
   myservo.attach(6);
 +
   Serial.begin (9600);  
 +
}
  
  // light the 3rd red LED
+
void loop() {
   module2.setLED(TM1638_COLOR_RED, 3);
+
   for (pos = 0; pos <= 180; pos += 1) {
  // light the 5th green LED
+
    myservo.write(pos);  
  module2.setLED(TM1638_COLOR_GREEN, 5);
+
  Serial.println(pos);            
   // light the 7th red and green LEDs
+
    delay(20);                     
   module2.setLED(TM1638_COLOR_RED | TM1638_COLOR_GREEN, 7);
+
   }
 +
   for (pos = 180; pos >= 0; pos -= 1) {
 +
    myservo.write(pos);  
 +
  Serial.println(pos);               
 +
    delay(20);                     
 +
  }
 
}
 
}
 +
</source>
  
void loop()
+
==== RBT servo ====
{
+
  byte key1, key2;
+
  
  // read the buttons from the first module
+
[[Soubor:servo_2.png|200px|right]]
  key1 = module1.getButtons();
+
  // read the buttons from the second module
+
  key2 = module2.getButtons();
+
  
  // both pressed
+
<source lang"Csharp">
  if (key1 != 0 && key2 != 0) {
+
    value = 0;
+
  
// set the display to 0 on both modules if they have buttons pressed simultaneously
+
#include <Servo.h>                    // Include servo library
    module1.setDisplayToHexNumber(value, 0b10101010);
+
    module2.setDisplayToDecNumber(value, 0b01010101);
+
Servo servoLeft;                     // Declare left servo signal
  } else {
+
  unsigned char motion = 0;
// check the first module buttons
+
    if (key1 != 0) {
+
      // show the pressed buttons of the first module on its display
+
      module2.setDisplayToBinNumber(key1, 0);
+
      // and on the LEDs
+
      module1.setLEDs(key1);
+
  
  // check to see if it's the last button pressed
+
void setup()                          // Built in initialization block
      if (key1 & 128) {
+
{
      // toggle the display state on/off
+
pinMode(5,INPUT_PULLUP);
        state = !state;
+
pinMode(6,INPUT_PULLUP);
        delay(200); // just wait for button up
+
pinMode(7,INPUT_PULLUP);
      }
+
pinMode(2,OUTPUT);
 +
pinMode(3,OUTPUT);
 +
pinMode(4,OUTPUT);
 +
pinMode(9,OUTPUT);
 +
  servoLeft.attach(9);              //  
 +
  Serial.begin (9600);
 +
}
  
  // set the intensity and display state
+
void loop()
      module1.setupDisplay(state, key1 >> 1);
+
{
    }
+
  motion = digitalRead(5) + digitalRead(6)*2 + digitalRead(7)*4;
 
+
  Serial.print(motion);
// check the second module buttons
+
  Serial.println(""); 
     if (key2 != 0) {
+
  switch(motion)
      // just add it to the display value
+
  {
      value += key2;
+
     case 0b00000110:  servoLeft.write(30); digitalWrite(4,HIGH); digitalWrite(3,HIGH); digitalWrite(2,LOW); break;
 
+
    case 0b00000101:  servoLeft.write(60); digitalWrite(4,HIGH); digitalWrite(3,LOW); digitalWrite(2,HIGH); break;
      // display it as an hexadecimal on the first module
+
    case 0b00000011:  servoLeft.write(90); digitalWrite(4,LOW); digitalWrite(3,HIGH); digitalWrite(2,HIGH); break;
      module1.setDisplayToHexNumber(value, 0b10101010);
+
    case 0b00000111:  servoLeft.write(120); digitalWrite(4,HIGH); digitalWrite(3,HIGH); digitalWrite(2,HIGH); break;
      // and as a decimal on the second module
+
     delay(15);
      module2.setDisplayToDecNumber(value, 0b01010101);
+
 
+
  // light the LEDs
+
      module2.setLEDs(key2 << 8);
+
     }
+
 
   }
 
   }
 
}
 
}
 +
</source>
  
 +
<source lang"Csharp">
 
</source>
 
</source>
 
 
[[Kategorie:SW]]
 
[[Kategorie:HW]]
 
[[Kategorie:MIT]]
 

Aktuální verze z 11. 6. 2021, 10:28

Arduino

Kniha Aruino.cz.png

  • Mikrokontrolér: AVR ATmega168 / ATmega328
  • Takt procesoru: 16 MHz
  • Pracovní napětí: 5V (Vstupní napětí (doporučené): 7 až 12V)
  • 14 digitálních vstupně-výstupních pinů (z toho 6 s podporou PWM)
  • 6 analogových vstupů
  • Proudové zatížení I/O pinu: 40mA
  • Flash paměť: 16 KB (ATmega168) nebo 32 KB (ATmega328), z toho 2 KB zabírá bootloader
  • SRAM: 1 KB (ATmega168) nebo 2 KB (ATmega328)
  • EEPROM: 512 bytů (ATmega168) nebo 1 KB (ATmega328)

Ardiono-day.jpg

Arduino Duemilanove
Download SW
Schéma

Obsah

Vývoj MIT aplikace s Arduino:

What we needs:

Sestavy:

Examples

Arduino-blik-01.jpg
/* Blink * http://www.arduino.cc/en/Tutorial/Blink
*/
 
int ledPin = 13;                // LED je připojena na pin 13
 
void setup(){                   // tato část proběhne jednou po startu
     pinMode(ledPin, OUTPUT);   // nastaví pin jako výstupní
}
 
void loop(){                      // procedura
    digitalWrite(ledPin, HIGH);   // rozsvícení LED
    delay(1000);                  // pauza 1s
    digitalWrite(ledPin, LOW);    // zhasnutí LED
    delay(1000);                  // pauza 1s
}

Tools:

  • .hex you can find in c:\Users\*\Local Settings\Temp\build*.tmp\*.hex

Tutorials:

Aplikace s Arduino

e

Videa

Experimenty


Arduino Shield by SPŠ

www

Arduino a USB

Pdf.jpg Arduino a PICAXE na Windows 8 64-bit


advance

Arduino IDE for programming Atmega Microcontrollers

How to program Arduino by using USBasp without bootloader

Building an Arduino on a Breadboard

Virtual Breadboard

Serial connection for your Arduino / Atmega

Basic Minimal Arduino Without Crystal

Minimal Arduino with ATmega8

Burning the Bootloader on ATMega328 using Arduino UNO as ISP

USBASP Bootloading a ATMega328p with a 8MHz internal clock

Make your own arduino serverino

Arduino Voice Control using Smartphone

Shield

How to Build the LOL Shield Kit

LoL Shield věnovaný sponzorem školy: jitenkaa, (zde je možné stavebnici objednat)

What is available...

Examples 2

  1. LED bliká v Morseově abecedě SOS ( . . . - - - . . . ) s opakováním s časovým odstupem 4 sekundy
  2. 8 LED bliká dle pravdivostní tabulky tak, aby svítala v daném čase postupně jen jedna LED (had)
  3. Aktivací tlačítka LED, která předtím svítila zhasne
  4. Každým zmáčknutím tlačítka se změní stav LED na opačný
  5. Jedním tlačítkem LED zhasne a jiným se rozsvítí

Test tlačítka

Button-LED.png
void setup()
{
  pinMode( 2, INPUT_PULLUP);
  pinMode( 8, OUTPUT);
}
 
void loop()
{
  digitalWrite( 8 , !digitalRead(2) );
}
const int buttonPin = 2;     // 
const int ledPin =  8;      // 
 
int buttonState = 0;         // variable
 
void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);
}
 
void loop() {
  buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH) {
    digitalWrite(ledPin, HIGH);
  }
  else {
    digitalWrite(ledPin, LOW);
  }
}

Traffic light

int pin;
 
void setup() {
       for (int i=4; i <= 13; i++){
        pinMode(i, OUTPUT);
   }
}
 
void blik(int pin)
{
        digitalWrite(pin, LOW);
        delay(500);
        digitalWrite(pin, HIGH);
}
 
void loop()
{
       for (int i=4; i <= 13; i++){
        blik(i);
   }
}

DC motor

L298N Arduino DC Motor H-Mustek.png
int MotorL1 = 3; 
int MotorL2 = 11; 
int MotorR1 = 5; 
int MotorR2 = 6; 
 
void loop() {
  MotorForward();              
  delay(2000);              
  TurnLeft(); 
  delay(2000);              
}
 
void MotorForward() {
  digitalWrite(MotorL1, LOW);   // 
  digitalWrite(MotorL2, HIGH);  // 
  digitalWrite(MotorR1, LOW);   // 
  digitalWrite(MotorR2, HIGH);  // 
 }
 
void TurnLeft() {
  analogWrite(MotorL1, LOW);   // 
  analogWrite(MotorL2, 128);  // 
  analogWrite(MotorR1, 128);   // 
  digitalWrite(MotorR2, LOW);  // 
 }

RGB

RGB-LED.png
.....
 
void loop()
{
  setColor(255, 0, 0);  // red
  delay(1000);
  setColor(0, 255, 0);  // green
  delay(1000);
  setColor(0, 0, 255);  // blue
  delay(1000);
  setColor(255, 255, 0);  // red + green
  delay(1000);  
  setColor(255, 0, 255);  // red + blue
  delay(1000);
  setColor(0, 255, 255);  // green + blue
  delay(1000);
}
 
void setColor(int red, int green, int blue)
{
  analogWrite(redPin, red);
  analogWrite(greenPin, green);
  analogWrite(bluePin, blue);  
}

SR04 ultrasonic

HC-SR04-ultrasonic.png
#define trigPin 8
#define echoPin 9
 
void setup() {
  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}
 
void loop() {
  long duration, distance;
  digitalWrite(trigPin, LOW);  
  delayMicroseconds(2); // 
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10); //
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
 
  Serial.print(distance);
  Serial.println(" cm");
  delay(500);
}

Servo

Servo.png
#include <Servo.h>
 
Servo myservo;  
 
int pos = 0;    
 
void setup() {
  myservo.attach(6); 
  Serial.begin (9600); 
}
 
void loop() {
  for (pos = 0; pos <= 180; pos += 1) { 
    myservo.write(pos); 
   Serial.println(pos);             
    delay(20);                       
  }
  for (pos = 180; pos >= 0; pos -= 1) { 
    myservo.write(pos); 
   Serial.println(pos);                
    delay(20);                       
  }
}

RBT servo

Servo 2.png
#include <Servo.h>                    // Include servo library
 
Servo servoLeft;                      // Declare left servo signal
  unsigned char motion = 0;
 
void setup()                          // Built in initialization block
{
 pinMode(5,INPUT_PULLUP);
 pinMode(6,INPUT_PULLUP);
 pinMode(7,INPUT_PULLUP);
 pinMode(2,OUTPUT);
 pinMode(3,OUTPUT);
 pinMode(4,OUTPUT);
 pinMode(9,OUTPUT);
  servoLeft.attach(9);               // 
  Serial.begin (9600);
}
 
void loop() 
{
  motion = digitalRead(5) + digitalRead(6)*2 + digitalRead(7)*4;
  Serial.print(motion);
  Serial.println("");  
  switch(motion)
  {
    case 0b00000110:  servoLeft.write(30); digitalWrite(4,HIGH); digitalWrite(3,HIGH); digitalWrite(2,LOW); break;
    case 0b00000101:  servoLeft.write(60); digitalWrite(4,HIGH); digitalWrite(3,LOW); digitalWrite(2,HIGH); break;
    case 0b00000011:  servoLeft.write(90); digitalWrite(4,LOW); digitalWrite(3,HIGH); digitalWrite(2,HIGH); break;
    case 0b00000111:  servoLeft.write(120); digitalWrite(4,HIGH); digitalWrite(3,HIGH); digitalWrite(2,HIGH); break;
    delay(15);
  }
}
 
Osobní nástroje
Jmenné prostory
Varianty
Akce
Rychlá navigace
NEJ aktivity
Nejlepší předměty
Nejlepší MCU
SW-HW
Ostatní
Utility
Nástroje
Tisk/export