 #define SCALE 32
 
 #include <FHT.h> // include the library
-
-const int NUM_SPELLS = 2;
-int *spell_length;
-int **spell_sequence;
-char **spell_name;
+#include <chibi.h>
+#include <Wire.h>
+#include <stdint.h>
+
+//// globals radio
+//
+  int hgmPin = 22;
+  int ledPin = 18;
+  int vbatPin = 31;
+  int vsolPin = 29;
+  int led_state = 1;
+  
+  #define ADCREFVOLTAGE 3.3
+  #define NODE_ID 300
+//
+
+//// globals spells
+//
+  const int NUM_SPELLS = 2;
+  int *spell_length;
+  int **spell_sequence;
+  char **spell_name;
+  int sound_buffer[FHT_N];
+  int current_note=0;
+  int note_duration=0;
+  int cur_sequence[10];
+  int seq_index=0;
+  int pin13_state=LOW;
+  int pin12_state=LOW;
+//
+
 
 int note_letter_to_int(char note)
 {


 make_spell(0, "Red Led", "CDEC");
 make_spell(1, "Green Led", "FGFG");
 Serial.println("setup done");
}

int sound_buffer[FHT_N];

void detect_note(float& note, float& volume)
{

           else
             pin13_state=LOW;
           digitalWrite(13, pin13_state);
           char sbuf[100];
           sprintf(sbuf, "SPELL:%s", spell_name[spell]);
           Serial.println(sbuf);
           chibiTx(BROADCAST_ADDR, (unsigned char*)(&sbuf), strlen(sbuf)+1);
           free(sbuf);           
          }
          if(spell==1)
          {
