     }
   }
 }
-void allSet(uint32_t c, uint8_t wait) 
-{
-  for(uint16_t i=0; i<strip.numPixels(); i++) 
-  {
-    strip.setPixelColor(i, c);
-    strip.show();
-    delay(wait);
-  }
-}
-void Fire(int Cooling, int Sparking, int SpeedDelay) {
-  static byte heat[60];
-  int cooldown;
-  
+void allSet(uint32_t c)
+{
+  for(int dot=0; dot<NUM_LEDS; dot++)
+  {
+    leds[dot] = CRGB::Black;
+    //pixels.setPixelColor(i,c);
+  }
+  FastLED.show();
+}
+// COOLING: How much does the air cool as it rises?
+// Less cooling = taller flames.  More cooling = shorter flames.
+// Default 55, suggested range 20-100 
+#define COOLING  55
+
+// SPARKING: What chance (out of 255) is there that a new spark will be lit?
+// Higher chance = more roaring fire.  Lower chance = more flickery fire.
+// Default 120, suggested range 50-200.
+#define SPARKING 120
+
+
+void Fire2012WithPalette()
+{
+// Array of temperature readings at each simulation cell
+  static byte heat[NUM_LEDS];
+
   // Step 1.  Cool down every cell a little
-  for( int i = 0; i < strip.numPixels(); i++) {
-    cooldown = random(0, ((Cooling * 10) / strip.numPixels()) + 2);
-    
-    if(cooldown>heat[i]) {
-      heat[i]=0;
-    } else {
-      heat[i]=heat[i]-cooldown;
-    }
-  }
-  
-  // Step 2.  Heat from each cell drifts 'up' and diffuses a little
-  for( int k= strip.numPixels() - 1; k >= 2; k--) {
-    heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2]) / 3;
-  }
-    
-  // Step 3.  Randomly ignite new 'sparks' near the bottom
-  if( random(255) < Sparking ) {
-    int y = random(7);
-    heat[y] = heat[y] + random(160,255);
-    //heat[y] = random(160,255);
-  }
-
-  // Step 4.  Convert heat to LED colors
-  for( int j = 0; j < strip.numPixels(); j++) {
-    setPixelHeatColor(j, heat[j] );
-  }
-
-  strip.show();
-  delay(SpeedDelay);
-}
-
-void setPixelHeatColor (int Pixel, byte temperature) {
-  // Scale 'heat' down from 0-255 to 0-191
-  byte t192 = round((temperature/255.0)*191);
- 
-  // calculate ramp up from
-  byte heatramp = t192 & 0x3F; // 0..63
-  heatramp <<= 2; // scale up to 0..252
- 
-  // figure out which third of the spectrum we're in:
-  if( t192 > 0x80) {                     // hottest
-    strip.setPixelColor(Pixel, random(0,256), random(0,256), random(0,256));
-  } else if( t192 > 0x40 ) {             // middle
-    strip.setPixelColor(Pixel, random(0,256), random(0,256), 0);
-  } else {                               // coolest
-    strip.setPixelColor(Pixel, heatramp, 0, 0);
-  }
-}
+    for( int i = 0; i < NUM_LEDS; i++) {
+      heat[i] = qsub8( heat[i],  random8(0, ((COOLING * 10) / NUM_LEDS) + 2));
+    }
+  
+    // Step 2.  Heat from each cell drifts 'up' and diffuses a little
+    for( int k= NUM_LEDS - 1; k >= 2; k--) {
+      heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
+    }
+    
+    // Step 3.  Randomly ignite new 'sparks' of heat near the bottom
+    if( random8() < SPARKING ) {
+      int y = random8(7);
+      heat[y] = qadd8( heat[y], random8(160,255) );
+    }
+
+    // Step 4.  Map from heat cells to LED colors
+    for( int j = 0; j < NUM_LEDS; j++) {
+      // Scale the heat value from 0-255 down to 0-240
+      // for best results with color palettes.
+      byte colorindex = scale8( heat[j], 240);
+      CRGB color = ColorFromPalette( gPal, colorindex);
+      int pixelnumber;
+      if( gReverseDirection ) {
+        pixelnumber = (NUM_LEDS-1) - j;
+      } else {
+        pixelnumber = j;
+      }
+      leds[pixelnumber] = color;
+    }
+}


  if(EL == 0 && XEL == 0)
  {
    Fire(55,120,5);
  }
  else
  {
    if(Transmit)
    {
      allSet(strip.Color(50,50,50),10);
      strip.show();
    }
    else
    {
      allSet(strip.Color(50,0,0),10);
      strip.show();
    }
  }


#include <FastLED.h>
#include <Servo.h>
#include <string.h>

#define NUM_LEDS 32
#define DATA_PIN 6
#define BRIGHTNESS  200
#define FRAMES_PER_SECOND 60
CRGBPalette16 gPal;
CRGB leds[NUM_LEDS];
//Connect USB port to Pi USB Port

//Adafruit_NeoPixel strip = Adafruit_NeoPixel(32, 6, NEO_GRB + NEO_KHZ800);
Servo XEL_servo;
Servo EL_servo;
bool gReverseDirection = false;
const int ledBluePin = 13;
String test;
int EL = 0;
