i have a WiFly RN-131c and i am trying to get it to work with Ninja Blocks. I can do it with the Ethernet shield. The NinjaWifly sketch that i have has been written for another version of WiFly that talks in Software Serial. My WiFly uses SPI.
Im trying to combine combine the sketches to get it to work. So far, this is what i have.
#include "NinjaBlockWiFly.h"
#include "RCSwitch.h"
#include "WiFly.h"
#define DSBEGIN()
#define DPRINT(item)
#define DPRINTLN(item)
#define DEFAULT_VENDOR_ID 0
#define LED_DEVICE_ID 1000
#define RF_DEVICE_ID 11
#define BUTTON_DEVICE_ID 5
#define NINJA_HOST 0
#define NODE_ID 1
#define VB_TOKEN 6S4mbWcpM0BFpPIstRIxiPbHpgKkvyFvQiZRPAotXg
byte led = 7; // Connect the anode (long lead, +ve) of a LED to this pin, and connect that LED's cathode (short lead, -ve) to GND through a 330R-1K resistor.
byte rfTx = 4; // transmit pin
RCSwitch mySwitch = RCSwitch();
char LED_VALUE[] = "000000";
void setup(){
//DSBEGIN();
Serial.begin(9600);
pinMode(led, OUTPUT);
WiFly.begin();
Serial.print("wifly begun");
WiFly.join("dmz", "2007aa2007");
Serial.print("IP: ");
Serial.println(WiFly.ip());
//NinjaBlock.client = wifly;
Serial.println("NinjaBlock.host = api.ninja.is;");
NinjaBlock.host = "api.ninja.is";
Serial.println("NinjaBlock.port = 80;");
NinjaBlock.port = 80;
Serial.println("NinjaBlock.nodeID = ARDUINOBLOCK;");
NinjaBlock.nodeID = "ARDUINOBLOCK";
Serial.println("NinjaBlock.token = ");
NinjaBlock.token = "I have my token in here.";
Serial.println("NinjaBlock.guid = 0;");
NinjaBlock.guid = "0";
//Register LED
Serial.println("Creating LED");
Serial.println("NinjaBlock.guid=0");
NinjaBlock.guid="0";
Serial.println("NinjaBlock.vendorID=DEFAULT_VENDOR_ID;");
NinjaBlock.vendorID=DEFAULT_VENDOR_ID;
Serial.println("NinjaBlock.deviceID=LED_DEVICE_ID;");
NinjaBlock.deviceID=LED_DEVICE_ID;
Serial.println("NinjaBlock.send(LED_VALUE);");
NinjaBlock.send(LED_VALUE);
//Register RF device
Serial.println("Creating RF device");
Serial.println("NinjaBlock.guid=0");
NinjaBlock.guid="1";
Serial.println("NinjaBlock.vendorID=DEFAULT_VENDOR_ID;");
NinjaBlock.vendorID=DEFAULT_VENDOR_ID;
Serial.println("NinjaBlock.deviceID = RF_DEVICE_ID;");
NinjaBlock.deviceID = RF_DEVICE_ID;
Serial.println("NinjaBlock.send(110111010101011100000000");
NinjaBlock.send("110111010101011100000000"); //sample RF string
}
There is lots of serial outputs so i can trace exactly where it goes pear shaped. It is looping the Setup() routine between these two commands.
NinjaBlock.send(LED_VALUE);
//Register RF device
Serial.println("Creating RF device");
Why would it be looping? Am i better off scrapping this and starting from scratch (with your help... ;))?