Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

Share

Prižiganje lučk z Arduinom

Download to read offline

Arduino basics for a workshop. In Slovenian language.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

Prižiganje lučk z Arduinom

  1. 1. Prižiganje lučk z Arduinom
  2. 2. Kaj bomo danes počele? Spoznale: ● Arduino Nano ● Testno ploščico (Breadboard) ● LED lučke, upornike, žičke, foto senzorje ● Osnove programiranja v C++ (spremenljivke, funkcija, for zanka) ● Koda: https://github.com/22nds/lfu-arduino-basics ● Arduino IDE: https://www.arduino.cc/en/Main/Software
  3. 3. Kaj potrebujemo? ● 2 x LED ● 1 x RGB LED ● 3 x 220 Ohm upornik ● 1 x 1k Ohm upornik ● 2 x žičke ● 1 x gumb ● 1 x senzor svetlobe ● Testna ploščica (Breadboard) ● USB kabel ● Računalnik ● Programska oprema (Arduino, Processing)
  4. 4. Arduino Nano Arduino Uno -> ● Uradna stran: https://store.arduino.cc/arduino-nano
  5. 5. Programska oprema za Arduino ● Arduino IDE https://www.arduino.cc/en/Main/Software ali ● Arduino Editor (online) https://create.arduino.cc/editor/ ali ● ArduinoDroid (Android): https://play.google.com/store/apps/details?id=name.antonsmirnov.android.arduinodroid2
  6. 6. Nastavitve za Arduino v Arduino IDE (Win/Linux) sudo chmod 777 /dev/ttyUSB0
  7. 7. Namestitev gonilnikov za Windows ● /driver/CH34x_Install_Windows_v3_4.zip ali ● http://sparks.gogo.co.nz/ch340.html ali ● http://www.arduined.eu/ch340-windows-8-driver-download/
  8. 8. Gonilniki za Mac https://kig.re/2014/12/31/how-to-use-arduino-nano-mini-pro-with-CH3 40G-on-mac-osx-yosemite.html Na Linuxu so gonilniki že nameščeni!
  9. 9. Source: https://static.ebayinc.com/static/assets/Uploads/Stories/Articles/_resampled/ScaleWidthWyI3NTgiXQ/castroevent3.jpg
  10. 10. Analogni pini analogRead() Digitalni pini pinMode() DigitalRead() DigitalWrite() AnalogWrite() - PWM 3, 5, 6, 9, 10, 11 Napajanje Power LED Test LED 13 (LED_BUILTIN)
  11. 11. Napajanje
  12. 12. Testna ploščica
  13. 13. LED lučke LED RGB LED +- R-GB
  14. 14. Uporniki - moč in računanje upora Upornik se upira električnemu toku in mu preprečuje, da bi nemoteno tekel skozenj. Napetost (V) = Tok(I) * Upor(R) Upor: 220 Ohmov Napetost: 5 Voltov ==================== Tok: 23 mA (mili amperov) 5V = 23 mA * 220 Oh 5V = 0.0227A * 220 Oh
  15. 15. 100 Ohm 220 Ohm 1k Ohm
  16. 16. http://www.resistorguide.com/resistor-color-code-calculator/
  17. 17. http://www.resistorguide.com/resistor-color-code-calculator/
  18. 18. http://www.resistorguide.com/resistor-color-code-calculator/
  19. 19. Lučka brez programa [00]
  20. 20. Utripanje lučke [01]
  21. 21. int LED = 2; void setup() { pinMode(LED, OUTPUT); } void loop() { digitalWrite(LED, HIGH); delay(1000); digitalWrite(LED, LOW); delay(1000); } [01]
  22. 22. [02]Utripanje lučke ob pritisku na gumb
  23. 23. Utripanje lučke ob pritisku na gumb [02]
  24. 24. Izmenično utripanje LED lučk [03]
  25. 25. Izmenično utripanje [03]
  26. 26. int led_one = 2; int led_two = 3; void setup() { // set up LED as OUTPUT pinMode(led_one, OUTPUT); pinMode(led_two, OUTPUT); } void loop() { digitalWrite(led_one, HIGH); digitalWrite(led_two, LOW); delay(500); // wait 0.5 second digitalWrite(led_one, LOW); digitalWrite(led_two, HIGH); delay(500); // wait 0.5 second } [03]
  27. 27. RGB lučka PWM pins * Pulse Width Modulation [04] [05] B G - R
  28. 28. RGB lučka menja barve [04]
  29. 29. int redPin = 3; int greenPin = 6; int bluePin = 5; void setup() { pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); } void loop() { setColor(255, 0, 0); // red delay(3000); setColor(0, 255, 0); // green delay(2000); setColor(0, 0, 255); // blue delay(1000); } void setColor(int red, int green, int blue) { analogWrite(redPin, red); analogWrite(greenPin, green); analogWrite(bluePin, blue); } [04]
  30. 30. RGB lučka pulzajoče barve [05]
  31. 31. int redPin = 3; int greenPin = 5; int bluePin = 6; int i; void setup() { // set up OUTPUTS pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); } void loop() { for (i=0; i<=255; i++) { analogWrite(redPin, i); analogWrite(greenPin, 0); analogWrite(bluePin, 0); delay(5); } } [05]
  32. 32. Senzorji in serial port
  33. 33. Foto-upornik & Serial port [06]
  34. 34. Senzor svetlobe in LED lučka [07]
  35. 35. Senzor svetlobe in LED lučka [07]
  36. 36. int sensorPin = A7; int led = 3; int input; int output; void setup() { Serial.begin(9600); } void loop() { input = analogRead(sensorPin); output = input / 4; delay(1000); analogWrite(led, output); Serial.print( input); Serial.print( " - "); Serial.println( output); } [07]
  37. 37. Processing Demo
  38. 38. https://processing.org/download/
  39. 39. Processing [08]
  40. 40. Foto-upornik & Serial port [08]
  41. 41. [08]int sensorPin = A7; int input; int output; void setup() { Serial.begin(9600); } void loop() { input = analogRead(sensorPin); output = input / 4; delay(10); Serial.println( output ); }
  42. 42. Processing sketch [08]
  43. 43. Processing - Rezultat [08]
  44. 44. Povezave
  45. 45. https://www.arduino.cc/
  46. 46. https://create.arduino.cc/projecthub
  47. 47. https://create.arduino.cc/editor
  48. 48. https://www.tinkercad.com/
  49. 49. http://fritzing.org/download/
  50. 50. https://smakshop.si
  51. 51. http://www.dx.com/s/arduino
  52. 52. https://www.arduino.cc/reference/en/
  53. 53. Extra
  54. 54. Namestitev gonilnikov za Windows - 2 ● http://www.wch.cn/download/CH341SER_ZIP.html SETUP.EXE

Arduino basics for a workshop. In Slovenian language.

Views

Total views

663

On Slideshare

0

From embeds

0

Number of embeds

0

Actions

Downloads

3

Shares

0

Comments

0

Likes

0

×