Show Posts
Pages: [1]
1  Topics / Home Automation and Networked Objects / Re: Wifly UDP parsing on: October 18, 2012, 12:41:07 pm
Thanks for writing, but this isn't working either, I still get the error "ISO C++ forbids comparison between pointer and integer"

which is coming from
Code:
void processString(char *parameter){
    while (*parameter != NULL) {   
      if (parameter[0] == "r") {
            int value = atoi(parameter+1);
            analogWrite(9, value);
       }
else if (parameter[0] == "g")) {
            int value = atoi(parameter+1);
            analogWrite(10, value);
       }
        else if (parameter[0] == "b"))  {
            int value = atoi(parameter+1);
            analogWrite(11, value);
       }
    parameter++;
    }
}
2  Topics / Home Automation and Networked Objects / Re: Wifly UDP parsing on: October 17, 2012, 10:02:55 pm
Quote
The "strtok" function works on a string of characters, not on a single character.
Well I guess I'm confused, because I thought my 'char d' was a string of Characters, the r128 g004 b023 that I gave in the example.

The iPhone app could include a closing character, but Im not sure how I would put it in an array like you say. Could you show me a code example?
3  Topics / Home Automation and Networked Objects / Wifly UDP parsing on: October 17, 2012, 05:42:29 pm
Can someone help me figure out what I'm doing wrong? I'm receiving a UDP message from my iphone, but I can't figure out how to parse it correctly.
The message being received is something like 'r128 g004 b023' (a three digit value for each of the three rgb colors).
Like I said, everything is working for the receiving part, but once I get it, I'm stuck.

Code:
void loop(){
  while (wifly.available() > 0)  {
  
    char d=wifly.read();
    char parameter = strtok (d, " ,");
    //parameter = strtok (NULL, " ,");
       
    while (*parameter != NULL) {   
       if (parameter[0] == "r") {
        int value = atoi(parameter+1);
        analogWrite(9, value);
       }
else if (parameter[0] == "g")) {
        int value = atoi(parameter+1);
        analogWrite(10, value);
       }
       else if (parameter[0] == "b"))  {
        int value = atoi(parameter+1);
        analogWrite(11, value);
       }    
    }    
    }
 }


But I'm getting "invalid conversion from 'char' to 'char*'" errors.
Could anyone help point me in the right direction for how to correctly parse this?
4  Topics / Home Automation and Networked Objects / Re: Arduino Uno, RN-XV, Seeed Relay Shield- Not working, what am I missing? on: October 17, 2012, 05:33:41 pm
Yep, that did it, I had the wrong pins, thank you! Told you I was a noob; now I understand softwareSerial a lot more.
5  Topics / Home Automation and Networked Objects / Arduino Uno, RN-XV, Seeed Relay Shield- Not working, what am I missing? on: October 14, 2012, 12:51:34 pm
Hello,
I have the following setup-
- Arduino UNO (http://arduino.cc/en/Main/ArduinoBoardUno/)
- Seeed Relay Shield (http://seeedstudio.com/wiki/Relay_Shield)
- Sparkfun WiFly RN-XV (http://www.sparkfun.com/products/10822)

and I've tried each of the following libraries-
- WiFlyHQ (https://github.com/harlequin-tech/WiFlyHQ)
- WiFlySerial (http://sourceforge.net/projects/arduinowifly/)

but nothing seems to work, I continually get the flashing red light on the WiFly, which from what I've read, means its not connected to a network.

Even this simple example to create an ad-hoc network, using the WiFlyHQ library, doesn't seem to work-
Code:
#include <WiFlyHQ.h>
#include <SoftwareSerial.h>
SoftwareSerial wifiSerial(8,9);

WiFly wifly;

void setup()
{
    Serial.begin(115200);
    Serial.println(F("Starting"));
    wifiSerial.begin(9600);
    wifly.begin(&wifiSerial, &Serial));

    wifly.createAdhocNetwork("wifly", 10);

    Serial.println(F("Network ready"));
}

void loop()
{
    wifly.terminal();
}

I have tried disconnecting the Seeed shield from the Arduino first, then uploaded my sketch, then reconnecting, as I've read having it connected can interfere with uploading sketches.

So aside from asking the insanely broad question of what am I doing wrong, I'll ask- is there anything I need to do to the WiFly first, to set it up directly?
I haven't read anything about having to do such a thing, but I can't think of anything else.
I've also read a few thing about a diode on pin 3 and having to remove it (http://www.instructables.com/id/Visual-Network-Threat-Level-Indicator-v2/step5/Fix-the-XBee-Shield/), but that is in reference to SparkFun's Xbee shield, so not sure if that would be applicable for my Seeed Shield.

I'm obviously a noob. Any help would be greatly appreciated, this is driving me crazy.
Pages: [1]