Arduino

(Rozdíly mezi verzemi)
Přejít na: navigace, hledání
(Shield)
(What is available...)
(Není zobrazeno 20 mezilehlých verzí od 1 uživatele.)
Řádka 4: Řádka 4:
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
 
|
 
|
 +
 +
[[Soubor:Kniha_Aruino.cz.png|link=http://arduino.cz/]]
 +
 
* Mikrokontrolér: [[AVR]] ATmega168 / ATmega328
 
* Mikrokontrolér: [[AVR]] ATmega168 / ATmega328
 
* Takt procesoru: 16 MHz
 
* Takt procesoru: 16 MHz
Řádka 13: Řádka 16:
 
* SRAM: 1 KB (ATmega168) nebo 2 KB (ATmega328)
 
* SRAM: 1 KB (ATmega168) nebo 2 KB (ATmega328)
 
* EEPROM: 512 bytů (ATmega168) nebo 1 KB (ATmega328)
 
* EEPROM: 512 bytů (ATmega168) nebo 1 KB (ATmega328)
 +
 +
[[Soubor:Ardiono-day.jpg|link=https://plzenskybarcamp.cz/2015/arduino-day]]
 
|}
 
|}
  
Řádka 26: Řádka 31:
 
Soubor:arduino_KNP.jpg|[http://www.gme.cz/atmega328p-pu-p432-228 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_KNP.jpg|[http://www.gme.cz/atmega328p-pu-p432-228 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_Nanino.jpg|[http://vonkonow.com/wordpress/2012/10/nanino-the-diy-friendly-arduino/ Nanino] + [http://goo.gl/J8zTA7 CP2104 s DTR]  
 
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_robotale.jpg|[http://goo.gl/yue7zB Board Arduino Compatible IDE]  
+
Soubor:Arduino_robotale.jpg|[http://www.ebay.com/itm/261653306720?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT NEW ATmega328P CH340G UNO R3]  
Soubor:Funduino_01.jpg|FR4 Funduino UNO Board for Arduino - Red]
+
Soubor:Ardiono-sestava.jpg|[http://m.aliexpress.com/item/32231653909.html?aff_click_id=83c00347b7fc4903ba0b68dbaf62215a-1467587308768-00765-UneMJZVf&aff_platform=y#autostay Ověřené za 25.58 $] [http://nakupycina.cz/jak-na-nakup-z-ciny/clo-a-dph-za-zbozi-z-ciny/ Pozor jen]
 
</Gallery>
 
</Gallery>
  
Řádka 51: Řádka 56:
 
</source>
 
</source>
  
=== [http://blog.ardublock.com/ ArdBlock] ===
+
== Tools: ==
([http://blog.ardublock.com/ ArduBlock] is a block programming language for Arduino)
+
  
[[Soubor:Arduino_blink.jpg|link=http://blog.ardublock.com/]]
+
<gallery>
 
+
Soubor:Arduino_blink.jpg|[http://blog.ardublock.com/ ArduBlock]
=== [http://sourceforge.net/projects/simulide/ SimulIDE] ===
+
Soubor:123d.jpg|[http://123d.circuits.io/ 123D Circuits - web Arduino IDE]
 
+
Soubor:simulide.jpg|[http://sourceforge.net/projects/simulide/ SimulIDE]
[[Soubor:simulide.jpg|link=http://sourceforge.net/projects/simulide/|400px]]
+
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
 
*.hex you can find in c:\Users\*\Local Settings\Temp\build*.tmp\*.hex
 
 
=== http://123d.circuits.io/ ===
 
 
[[Soubor:123d.jpg|link=http://http://123d.circuits.io/|400px]]
 
  
 
== Tutorials: ==
 
== 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_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: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:Introduction_to_the_Arduino.jpg|[http://www.youtube.com/watch?v=CqrQmQqpHXc An Introduction to the Arduino]
Řádka 82: Řádka 85:
 
Soubor:arduino-playground.jpg| [http://playground.arduino.cc/Code/BitMath#binary Bit Math Tutorial by CosineKitty]
 
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]
 
Soubor:arduino-wiring-ledswing.jpg| [http://wiring.org.co/learning/basics/ledswing.html Learning with Wiring -LEDSwing]
</gallery>
 
 
== 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]]
 
LoL Shield věnovaný sponzorem školy: [http://aukro.cz/listing/user.php?us_id=23961189 jitenkaa], (zde je možné stavebnici objednat)
 
 
{{#widget:YouTube|id=sWpqH37Zb9M|height=360|width=480|LoL Shield od sponzora jitenkaa|centre}}
 
 
<gallery>
 
Soubor:Arduino_4WD_robot-smart.jpg|[http://goo.gl/YOGRFI 4WD Robot Smart Car Chassis Kits]
 
Soubor:Arduino_deal.jpg|[http://goo.gl/bzhxD9 Arduino Robot Car Kits]
 
Soubor:propoj_kabel.jpg|[http://goo.gl/TDgqj8 M-M] M-F F-F
 
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]
 
Soubor:8-Segment_LED.jpg|[http://goo.gl/Vejtxk MAX7219 Red Module 8-Digit 7 Segment]
 
Soubor:dot-matrix-display.jpg|[http://goo.gl/MdVGl6 MAX7219 Dot matrix Arduino]
 
Soubor:CP2104.jpg|[http://goo.gl/U4ajVi|USB CP2104 TTL]
 
Soubor:ht1632c.jpg|[http://dx.com/p/jy-mcu-3208-lattice-clock-ht1632c-driver-with-mcu-support-secondary-development-104306 Clock HT1632C CZ 236]
 
Soubor:R8X_Digital.jpg|[http://goo.gl/LxJdXJ 8-Bit Double Color LED TM1638 Arduino]
 
Soubor:lcd-keypad-shield-for-arduino.jpg|[http://goo.gl/dTfeHv LCD Keypad Shield]
 
Soubor:Arduino-Clock-Shield.jpg|[http://www.seeedstudio.com/wiki/Tick_Tock_Shield_Kit Clock Shield Wire Digital Module - Blue + Black]
 
Soubor:Arduino-Stepper-Motor-ULN2003.jpg|2X DC 5V Stepper Motor + ULN2003 Driver Test Module Board 28BYJ-48 for Arduino
 
Soubor:Arduino-L293D-Module-4-DC.jpg|L293D Module 4 DC Motor Drive Module 4WD Car
 
Soubor:MAX7219-Dot-Led-Matrix-Module-Arduino.jpg|[http://goo.gl/Pm2lNo MAX7219 Dot Led Matrix Module Arduino]
 
Soubor:Motor-drive-L293D.jpg|[http://goo.gl/blES3Y Motor Drive Shield Expansion Board L293D]
 
Soubor:IIC-Serial-Interface-LCD.jpg|[http://goo.gl/OZYx1x IIC/I2C/TWI/SPI Serial Interface Arduino 1602LCD]
 
Soubor:ISD1820-Voice-Board.jpg|[http://goo.gl/iob0l6 ISD1820 Voice Board]
 
Soubor:RTC-Arduino.jpg|[http://goo.gl/4xY2Ny RTC DS1307 I2C AT24C32 Arduino]
 
Soubor:Bluetooth-Arduino.jpg|[http://goo.gl/aWFkIi Bluetooth Transceiver Module] [http://www.buildcircuit.com/decimal-to-binary-converter-using-cd4094-android-phone-and-bluesmirf/ aplikace]
 
Soubor:Arduino-Ethernet.jpg|[http://goo.gl/KIHK4H Arduino Ethernet Shield W5100 + microSD]
 
Soubor:Arduino-Power-Supply.jpg|[http://goo.gl/bHMnT2 Breadboard Power Supply Module Arduino]
 
Soubor:Arduino-Full-Color-RGB.jpg|[http://goo.gl/VBRXSX Full Color RGB 8-SMD 5050 LED Module]
 
 
</gallery>
 
</gallery>
  
Řádka 138: Řádka 109:
  
  
 +
== Arduino Shield by SPŠ ==
  
 +
<Gallery>
 +
Soubor:arduino_shield_UNI.jpg
 +
</Gallery>
  
 
== www ==
 
== www ==
Řádka 172: Řádka 147:
  
 
[http://www.instructables.com/id/Make-your-own-arduino-serverino/?ALLSTEPS Make your own arduino serverino]
 
[http://www.instructables.com/id/Make-your-own-arduino-serverino/?ALLSTEPS Make your own arduino serverino]
 +
 +
[https://www.youtube.com/watch?v=3imfP2TZbNc Arduino Voice Control using Smartphone]
 +
 +
== 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]]
 +
LoL Shield věnovaný sponzorem školy: [http://aukro.cz/listing/user.php?us_id=23961189 jitenkaa], (zde je možné stavebnici objednat)
 +
 +
{{#widget:YouTube|id=sWpqH37Zb9M|height=360|width=480|LoL Shield od sponzora jitenkaa|centre}}
 +
 +
<gallery>
 +
Soubor:Arduino_4WD_robot-smart.jpg|[http://goo.gl/YOGRFI 4WD Robot Smart Car Chassis Kits]
 +
Soubor:Arduino_deal.jpg|[http://goo.gl/bzhxD9 Arduino Robot Car Kits]
 +
Soubor:CP2104.jpg|[http://goo.gl/U4ajVi|USB CP2104 TTL]
 +
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]
 +
 +
Soubor:ht1632c.jpg|[https://www.instructables.com/User-Manual-MAX7219-Dot-Matrix-4-in-1/ MAX7219 Matrix Display]
 +
 +
 +
</gallery>
 +
 +
=== What is available... ===
 +
 +
<gallery>
 +
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]
 +
 +
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]
 +
Soubor:R8X_Digital.jpg|[http://goo.gl/LxJdXJ 8-Bit Double Color LED TM1638 Arduino]
 +
 +
Soubor:lcd-keypad-shield-for-arduino.jpg|[http://goo.gl/dTfeHv LCD Keypad Shield]
 +
Soubor:IIC-Serial-Interface-LCD.jpg|[http://goo.gl/OZYx1x IIC/I2C/TWI/SPI Serial Interface Arduino 1602LCD]
 +
 +
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]
 +
 +
Soubor:RTC-Arduino.jpg|[http://goo.gl/4xY2Ny RTC DS1307 I2C AT24C32 Arduino]
 +
 +
Soubor:ISD1820-Voice-Board.jpg|[http://goo.gl/iob0l6 ISD1820 Voice Board]
 +
 +
Soubor:Arduino-Stepper-Motor-ULN2003.jpg|[http://goo.gl/YtQEAv 2X DC 5V Stepper Motor + ULN2003 Driver Test Module Board 28BYJ-48 for Arduino]
 +
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
 +
 +
Soubor:DHT11 _1113.png|[http://www.micro4you.com/files/sensor/DHT11.pdf Arduino senzor vlhkosti a teploty DHT11]
 +
 +
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]
 +
 +
Soubor:Cidlo_teploty_a_vlhkosti_DHT22_AM2302.png|[http://mcustore.cz/products/102005/DHT22.pdf Čidlo teploty a vlhkosti DHT22]
 +
Soubor:Membranova_klavesnice_4x3.png|Membránová klávesnice 4x3 Slim
 +
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č]
 +
 +
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]
 +
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]
 +
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:Multifunctional Expansion Board.png|[http://goo.gl/CptDtu Multifunctional Expansion Board Arduino]
 +
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>
 +
 +
=== 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í
 +
 +
==== Test tlačítka ====
 +
[[Soubor:Button-LED.png|200px|right]]
 +
 +
<source lang"Csharp">
 +
void setup()
 +
{
 +
  pinMode( 2, INPUT_PULLUP);
 +
  pinMode( 8, OUTPUT);
 +
}
 +
 +
void loop()
 +
{
 +
  digitalWrite( 8 , !digitalRead(2) );
 +
}
 +
</source>
 +
 +
<source lang"Csharp">
 +
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);
 +
  }
 +
}
 +
</source>
 +
 +
==== Traffic light ====
 +
 +
[[Soubor:Test-traffic-light.png|200px|right]]
 +
<source lang="csharp">
 +
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);
 +
  }
 +
}
 +
 +
</source>
 +
 +
==== DC motor ====
 +
 +
[[Soubor:L298N_Arduino_DC_Motor_H-Mustek.png|200px|right]]
 +
<source lang="csharp">
 +
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);  //
 +
}
 +
</source>
 +
 +
==== RGB ====
 +
 +
[[Soubor:RGB-LED.png|200px|right]]
 +
 +
<source lang="csharp">
 +
.....
 +
 +
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); 
 +
}
 +
 +
</source>
 +
 +
==== SR04 ultrasonic ====
 +
 +
[[Soubor:HC-SR04-ultrasonic.png|200px|right]]
 +
 +
<source lang="Csharp">
 +
#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);
 +
}
 +
</source>
 +
 +
==== Servo ====
 +
 +
[[Soubor:servo.png|200px|right]]
 +
<source lang"Csharp">
 +
#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);                     
 +
  }
 +
}
 +
</source>
 +
 +
==== RBT servo ====
 +
 +
[[Soubor:servo_2.png|200px|right]]
 +
 +
<source lang"Csharp">
 +
 +
#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);
 +
  }
 +
}
 +
</source>
 +
 +
<source lang"Csharp">
 +
</source>

Verze z 8. 1. 2021, 19:01

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