Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
fabricademy2017:students:nuria.robles:week_12 [2018/02/15 13:29]
nuriafablab_gmail.com
fabricademy2017:students:nuria.robles:week_12 [2018/02/15 13:35]
nuriafablab_gmail.com
Line 60: Line 60:
  
 **I**  installed the Gemma Board following these steps in the [[https://​learn.adafruit.com/​adafruit-arduino-ide-setup/​overview|Adafruit Arduino IDE setup guide]] to easily install a pre-configured Arduino IDE to program Gemma! **I**  installed the Gemma Board following these steps in the [[https://​learn.adafruit.com/​adafruit-arduino-ide-setup/​overview|Adafruit Arduino IDE setup guide]] to easily install a pre-configured Arduino IDE to program Gemma!
- 
-**[[https://​learn.adafruit.com/​add-boards-arduino-v164|If you are running Arduino IDE 1.6.4 or greater, you can also use this quickstart guide to add in the Gemma plugin]]** 
  
 **Blink!** **Blink!**
  
-After the instalation,​ is very useful to upload the **blink** ​ code to the board and see that your PC is talking to your board+After the instalation,​ is very useful to upload the **blink** ​ code to the board and see that your PC is talking to your board. I followed this [[https://​learn.adafruit.com/​introducing-gemma/​setting-up-with-arduino-ide#​|tutorial]] from Adafruit 
 + 
 +And whe it all was done, I uploaded the code for the 3 neopixels
  
 <​code>​ <​code>​
-**/* +#include <​Adafruit_NeoPixel.h>
-  Blink +
-  Turns on an LED on for one second, then off for one second, repeatedly.+
  
-  This example code is in the public domain.+#define NUM_LEDS 3 // Number of NeoPixels: 3 in my case
  
-  To upload to your  or Trinket: +#define PIN 1 // DIGITAL pin # where NeoPixels are connected // IMPORTANT: Avoid connecting on a live circuit...
-  ​1) Select the proper board from the Tools->​Board Menu (Arduino Gemma if +
-     teal, Adafruit Gemma if black) +
-  2) Select the uploader from the Tools->​Programmer ("​Arduino Gemma" if teal, +
-     "​USBtinyISP"​ if black Gemma) +
-  3) Plug in the Gemma into USB, make sure you see the green LED lit +
-  4) For windows, make sure you install the right Gemma drivers +
-  5) Press the button on the Gemma/Trinket - verify you see +
-     the red LED pulse. This means it is ready to receive data +
-  6) Click the upload button above within 10 seconds +
-*/+
  
-int led = 1; // blink '​digital'​ pin 1 - AKA the built in red LED+// if you must, connect GND first.
  
-// the setup routine runs once when you press reset: +Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDSPIN);
-void setup() { +
-  // initialize the digital pin as an output. +
-  pinMode(ledOUTPUT);+
  
 +void setup() {
 +strip.begin();​
 +strip.setBrightness(50);​ // 100/255 brightness (about 40%) strip.show();​ // Initialize all pixels to '​off'​
 } }
- 
-// the loop routine runs over and over again forever: 
 void loop() { void loop() {
-    digitalWrite(led, HIGH)+for(int j=0j<256; j++) { 
-    delay(1000); +for(int i=0; i<​NUM_LEDS;​ i++) { strip.setPixelColor(i,​ Wheel((i * 8 + j) & 255)); 
-    ​digitalWrite(led, LOW); +    ​
-    delay(1000); +    strip.show(); 
-}** +    delay(40); 
-</​code>​+
 +}
  
-**flora_gemmaselect.gif https://cdn-learn.adafruit.com/​assets/​assets/​000/​010/​921/​large1024/​flora_gemmaselect.gif?​1448055330**+// Input a value 0 to 255 to get a color value. 
 +// The colours are a transition r g - b - back to r. 
 +uint32_t Wheel(byte WheelPos) { 
 +if(WheelPos <85) { 
 +return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); 
 +} else if(WheelPos <170) { 
 +WheelPos -= 85; 
 +return strip.Color(255 - WheelPos ​3, 0, WheelPos ​3); 
 +} else { 
 +WheelPos -= 170; 
 +return strip.Color(0,​ WheelPos * 3, 255 - WheelPos * 3); 
 +} } 
 +</​code>​
  
 \\ \\