Operácie

Aj Ty v IT: Rozdiel medzi revíziami

Z SensorWiki

(Druhá časť)
(Svetielkujúci Workshop 7. a 14. 6. 2017)
(13 medziľahlých úprav od rovnakého používateľa nie je zobrazených.)
Riadok 1: Riadok 1:
 
[[Súbor:logoAjTyvIT.png|right|150px]]
 
[[Súbor:logoAjTyvIT.png|right|150px]]
  
= '''Svetielkujúci Workshop 7. a 14. 6. 2017''' =
+
= '''Svetielkujúci Workshop 18. 12. 2017''' =
+
<!--
 +
= '''Svetielkujúci Workshop 7. a 14. 6. 2017''' =  
 +
-->
 +
<P Align="center">
 +
<gallery widths=120px heights=120px perrow=4 caption="Svetielkujuci Workshop 1 (jún 2017)">
 +
File:FotoBlikBlik01.jpg
 +
File:FotoBlikBlik02.jpg
 +
File:FotoBlikBlik03.jpg
 +
File:FotoBlikBlik04.jpg
 +
File:FotoBlikBlik05.jpg
 +
File:FotoBlikBlik06.jpg
 +
File:FotoBlikBlik07.jpg
 +
File:FotoBlikBlik08.jpg
 +
</gallery>
  
 
[[Súbor:wearableDef.png|500px]]
 
[[Súbor:wearableDef.png|500px]]
 
  
  
Riadok 13: Riadok 25:
 
* [http://senzor.robotika.sk/balogh/wearable.pdf Úvodná prezentácia]
 
* [http://senzor.robotika.sk/balogh/wearable.pdf Úvodná prezentácia]
 
** [https://player.vimeo.com/video/114828162 Spider dress video]
 
** [https://player.vimeo.com/video/114828162 Spider dress video]
 +
** [https://www.dezeen.com/2017/10/22/ying-gaos-dresses-become-animated-in-the-presence-of-strangers/ Ying Gaos dress]
 
** [https://cutecircuit.com/wearable-technology/ Cute Circuit]
 
** [https://cutecircuit.com/wearable-technology/ Cute Circuit]
 
* [https://learn.adafruit.com/category/wearables Wearables od firmy Adafruit]
 
* [https://learn.adafruit.com/category/wearables Wearables od firmy Adafruit]
Riadok 21: Riadok 34:
 
** 5: [https://learn.adafruit.com/light-activated-pixel-heart/ Brošňa]
 
** 5: [https://learn.adafruit.com/light-activated-pixel-heart/ Brošňa]
  
== Krok za krokom ==
+
== '''1. Krok za krokom''' ==
  
== 1. '''Blink''' ==
+
== 1.1. '''Blink''' ==
  
 
* [http://ap.urpi.fei.stuba.sk/sensorwiki/index.php/Acrob02 Blink]
 
* [http://ap.urpi.fei.stuba.sk/sensorwiki/index.php/Acrob02 Blink]
  
== 2. '''Železničné priecestie''' ==
+
== 1.2. '''Železničné priecestie''' ==
  
 
* [https://youtu.be/YaH8DJpeYs0?t=1m6s Video]
 
* [https://youtu.be/YaH8DJpeYs0?t=1m6s Video]
  
== 3. '''K.I.T.T. 2000''' ==
+
== 1.3. '''K.I.T.T. 2000''' ==
  
 
* [https://youtu.be/iQwlrEdka6Q?t=5s Video]
 
* [https://youtu.be/iQwlrEdka6Q?t=5s Video]
  
 +
== 1.4. Ak to nefunguje... ==
 +
 +
...tak [[Acrob Settings|skontrolujte nastavenia]].
  
 +
<BR>
 +
<BR>
 +
<BR>
  
= Druhá časť =
+
= '''2. A teraz už naozaj...''' =
  
  
== Adafruit Gemma ==
+
== 2.1. Adafruit Gemma ==
  
 
* [https://learn.adafruit.com/introducing-gemma/ Stránka u výrobcu so všetkými informáciami]
 
* [https://learn.adafruit.com/introducing-gemma/ Stránka u výrobcu so všetkými informáciami]
Riadok 57: Riadok 76:
 
[[Súbor:gemma_flora_selectusbtiny.gif|center]]
 
[[Súbor:gemma_flora_selectusbtiny.gif|center]]
  
 +
 +
== 2.2. Blink  ==
 +
 +
Príklad čiapky s obyčajnými LED diódami - ukážka šitia: https://learn.adafruit.com/adafruit-led-sequins/
  
 
Vyskúšame postupne jednoduché programy
 
Vyskúšame postupne jednoduché programy
Riadok 114: Riadok 137:
 
</source>
 
</source>
  
== NeoPixel RGB ==
+
 
 +
Plynulá zmena intenzity svitu LED diody (funguje len na D0 a D1, na D2 NIE)
  
 
<source lang="C">
 
<source lang="C">
#include <Adafruit_NeoPixel.h>
+
int intenzita;
 
+
 
#define PIN 1
 
 
 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);
 
 
 
 
void setup() {
 
void setup() {
 
+
    intenzita = 0;
  strip.begin();
+
    pinMode(2,OUTPUT);
// strip.setPixelColor(n, red, green, blue, white);
 
  strip.setPixelColor(0, 0, 0, 127);
 
  strip.show(); // Initialize all pixels to 'off'
 
  delay(2000);
 
 
}
 
}
  
 
void loop() {
 
void loop() {
  strip.setBrightness(100);
+
    intenzita = 0;
  // Some example procedures showing how to display to the pixels:
+
    for(int i=0; i<10 ; i++)
  colorWipe(strip.Color(255, 0, 0), 50); // Red
+
    {
  colorWipe(strip.Color(0, 255, 0), 50); // Green
+
        intenzita = intenzita + 25;
  colorWipe(strip.Color(0, 0, 255), 50); // Blue
+
        analogWrite(2,intenzita);
//colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW
+
    }
  // Send a theater pixel chase in...
 
//  theaterChase(strip.Color(127, 127, 127), 50); // White
 
//  theaterChase(strip.Color(127, 0, 0), 50); // Red
 
//  theaterChase(strip.Color(0, 0, 127), 50); // Blue
 
  
  rainbow(20);
 
//  rainbowCycle(20);
 
//  theaterChaseRainbow(50);
 
 
}
 
}
 +
</source>
  
 +
== 2.3. NeoPixel RGB ==
  
  
 +
Priklady práce s inteligentnou RGB LED diódou [https://blog.adafruit.com/2013/08/30/adafruit-neopixel-uberguide/ Neopixel].
  
// Fill the dots one after the other with a color
+
Napríklad takáto [https://learn.adafruit.com/led-masquerade-masks/neopixel-gemma-mask maska na maškarný bál...]
void colorWipe(uint32_t c, uint8_t wait) {
 
  for(uint16_t i=0; i<strip.numPixels(); i++) {
 
    strip.setPixelColor(i, c);
 
    strip.show();
 
    delay(wait);
 
  }
 
}
 
  
void rainbow(uint8_t wait) {
+
ToDo: niekoľko pekných ukážkových programov, ktoré by sa dali vlastne aplikovať aj na obyčajné diódy http://moving-rainbow.readthedocs.io/en/latest/guide/list-of-sample-programs/
  uint16_t i, j;
+
Schéma pripojenia
  
  for(j=0; j<256; j++) {
+
[[Súbor:AdafruitNeoPixelConnection.jpg]]
    for(i=0; i<strip.numPixels(); i++) {
 
      strip.setPixelColor(i, Wheel((i+j) & 255));
 
    }
 
    strip.show();
 
    delay(wait);
 
  }
 
}
 
  
// Slightly different, this makes the rainbow equally distributed throughout
 
void rainbowCycle(uint8_t wait) {
 
  uint16_t i, j;
 
  
  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
+
Základný príklad s jednou diódou
    for(i=0; i< strip.numPixels(); i++) {
 
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
 
    }
 
    strip.show();
 
    delay(wait);
 
  }
 
}
 
  
//Theatre-style crawling lights.
+
<source lang="C">
void theaterChase(uint32_t c, uint8_t wait) {
+
#include <Adafruit_NeoPixel.h>
  for (int j=0; j<10; j++) {  //do 10 cycles of chasing
+
    for (int q=0; q < 3; q++) {
+
#define PIN 1
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
+
        strip.setPixelColor(i+q, c);    //turn every third pixel on
+
Adafruit_NeoPixel LED = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);
      }
+
      strip.show();
+
void setup() {
 
+
   
      delay(wait);
+
  LED.begin();
 
+
// LED.setPixelColor(n, red, green, blue);
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
+
  LED.setPixelColor(0, 0, 0, 127);
        strip.setPixelColor(i+q, 0);       //turn every third pixel off
+
   LED.show(); // Show the preset color(s)
      }
+
  delay(2000);
    }
+
  LED.setBrightness(100);
  }
+
  }
 +
 +
void loop()
 +
//                n  R  G  B 
 +
  LED.setPixelColor(0, 255, 0, 127);
 +
  delay(2000);
 +
  LED.setPixelColor(0,  0 , 0, 0);
 +
  delay(2000);
 +
 
 
}
 
}
 +
 +
 +
 +
</source>
  
//Theatre-style crawling lights with rainbow effect
+
Základný príklad s dvoma diódami
void theaterChaseRainbow(uint8_t wait) {
+
<source lang="C">
  for (int j=0; j < 256; j++) {    // cycle all 256 colors in the wheel
+
#include <Adafruit_NeoPixel.h>
    for (int q=0; q < 3; q++) {
+
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
+
#define PIN 1
        strip.setPixelColor(i+q, Wheel( (i+j) % 255));   //turn every third pixel on
+
      }
+
Adafruit_NeoPixel LED = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);
      strip.show();
+
 
+
void setup() {
      delay(wait);
+
 
+
  LED.begin();
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
+
  LED.show(); // Show the preset color(s)
        strip.setPixelColor(i+q, 0);       //turn every third pixel off
+
  LED.setBrightness(100); // Interval 0 - 255
      }
 
    }
 
  }
 
 
}
 
}
 
+
// Input a value 0 to 255 to get a color value.
+
void loop() {
// The colours are a transition r - g - b - back to r.
+
    
uint32_t Wheel(byte WheelPos) {
+
   // LED.setPixelColor(n, red, green, blue);
   WheelPos = 255 - WheelPos;
+
    LED.setPixelColor(0, 255, 0, 0); // First LED Red
   if(WheelPos < 85) {
+
    LED.setPixelColor(1, 0, 0, 127);  // Second LED Blue
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
+
    LED.show();
  }
+
    delay(300);
  if(WheelPos < 170) {
+
    LED.setPixelColor(0, 0, 0, 127); // First LED Blue
    WheelPos -= 85;
+
    LED.setPixelColor(1, 255, 0, 0); // Second LED Red
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
+
    LED.show();
  }
+
    delay(300);
  WheelPos -= 170;
+
   
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
+
 
 
}
 
}
 
</source>
 
</source>
Priklady na neopixel
+
 
 +
A celkom na záver: ako prať elektronické odevy?
 +
https://learn.adafruit.com/washing-wearable-electronics/hand-wash?view=all
 +
 
  
 
=== Technicke informacie ===
 
=== Technicke informacie ===

Verzia zo dňa a času 08:22, 12. december 2017

LogoAjTyvIT.png

Svetielkujúci Workshop 18. 12. 2017

WearableDef.png


Úvod

1. Krok za krokom

1.1. Blink

1.2. Železničné priecestie

1.3. K.I.T.T. 2000

1.4. Ak to nefunguje...

...tak skontrolujte nastavenia.




2. A teraz už naozaj...

2.1. Adafruit Gemma

AdafruitGemma.png

V programovacom prostredí Arduino treba najprv nastaviť typ elektronickej dosky na Adafruit Gemma 8MHz v menu Tools->Board.

Flora gemmaselect.gif


Potom ešte treba vybrať vhodný programovací protokol - vyeberiete ho z menu Tools->Programmer->USBtinyISP

Gemma flora selectusbtiny.gif


2.2. Blink

Príklad čiapky s obyčajnými LED diódami - ukážka šitia: https://learn.adafruit.com/adafruit-led-sequins/

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);

}


Plynulá zmena intenzity svitu LED diody (funguje len na D0 a D1, na D2 NIE)

int intenzita;
  
void setup() {
    intenzita = 0;
    pinMode(2,OUTPUT);
}

void loop() {
    intenzita = 0;
    for(int i=0; i<10 ; i++)
    {
        intenzita = intenzita + 25;
        analogWrite(2,intenzita);
    }

}

2.3. NeoPixel RGB

Priklady práce s inteligentnou RGB LED diódou Neopixel.

Napríklad takáto maska na maškarný bál...

ToDo: niekoľko pekných ukážkových programov, ktoré by sa dali vlastne aplikovať aj na obyčajné diódy http://moving-rainbow.readthedocs.io/en/latest/guide/list-of-sample-programs/ Schéma pripojenia

AdafruitNeoPixelConnection.jpg


Základný príklad s jednou diódou

#include <Adafruit_NeoPixel.h>
 
#define PIN 1
 
Adafruit_NeoPixel LED = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);
 
void setup() {
 
   LED.begin();
// LED.setPixelColor(n, red, green, blue);
   LED.setPixelColor(0, 0, 0, 127);
   LED.show(); // Show the preset color(s)
   delay(2000);
   LED.setBrightness(100);
   }
 
void loop() {  
 //                 n   R   G   B  
  LED.setPixelColor(0, 255, 0, 127);
  delay(2000);
  LED.setPixelColor(0,  0 , 0, 0);
  delay(2000);
   
}

Základný príklad s dvoma diódami

#include <Adafruit_NeoPixel.h>
 
#define PIN 1
 
Adafruit_NeoPixel LED = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);
 
void setup() {
 
   LED.begin();
   LED.show(); // Show the preset color(s)
   LED.setBrightness(100);  // Interval 0 - 255
}
 
void loop() {  
  
  // LED.setPixelColor(n, red, green, blue);
     LED.setPixelColor(0, 255, 0, 0);  // First LED Red
     LED.setPixelColor(1, 0, 0, 127);  // Second LED Blue
     LED.show();
     delay(300);
     LED.setPixelColor(0, 0, 0, 127);  // First LED Blue
     LED.setPixelColor(1, 255, 0, 0);  // Second LED Red
     LED.show();
     delay(300);
     
   
}

A celkom na záver: ako prať elektronické odevy?

https://learn.adafruit.com/washing-wearable-electronics/hand-wash?view=all


Technicke informacie