Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: [SOLVED] String comparison after serial read on: December 14, 2013, 06:35:23 am
Thx for that one, I'll have a look at it later this week since works gonna take up most of my time the next few days.. smiley-sad
2  Using Arduino / Programming Questions / Re: String comparison after serial read on: December 13, 2013, 10:12:51 am
Thanks for saving my day! The #-check showed my output was correct so it was the comparison which was the problem.

if ( t.startsWith("off") ) worked like it should, my serial output showed up only the led didn't work but that was another problem..

(I forgot -->  pinMode(testLed, OUTPUT); ...)
Seems to be working great now!

3  Using Arduino / Programming Questions / Re: String comparison after serial read on: December 13, 2013, 09:49:41 am
I see the exact same word I sent from my phone to the arduino in the serial terminal on my computer.
I can see that processData() is being called since my serial terminal also sends the word processing and that's all that happens...
4  Using Arduino / Programming Questions / Re: String comparison after serial read on: December 13, 2013, 09:40:35 am
I'm quite new to this so I followed some tutorials and changed/added some stuff here and there to get it working the way it is now. I don't know how else to do it.

I have tried without h--; but then it displays the word and skips to a new line on my serial terminal.

The data i'm getting seems to be allright, it's just not comparable..
5  Using Arduino / Programming Questions / [SOLVED] String comparison after serial read on: December 13, 2013, 09:05:39 am
I am trying to compare a string created from characters sent over serial to a word. If the word "no" matches, led 13 should turn on, and if the word "off" matches, led 13 should turn off.
All goess right untill the comparison is made, I checked by writing back results to serial.
I just can't get it to work? Any ideas?

Code:
String inData;
String test;
int testLed = 13; // LED on pin 13

void setup()
{
  Serial.begin(9600);
}


void loop(){
  inData="";
  if (Serial.available() > 0) {
    int h=Serial.available();    
   h--;

    for (int i=0;i<h;i++){
      inData += (char)Serial.read();
       }
   Serial.read();
  }
  //print it out
  if (inData == "") {
    //There is no spoon!
  }
  else
  {
    Serial.println(inData);
    processData();
  }
  delay(50); // Without delay, no data is shown in serial monitor.
}

void processData(){
      String t = inData;
      Serial.println("processing");
      if (t == "on") {
      Serial.println("light go ON");
      digitalWrite(testLed, HIGH);}
      if (t == "off"){
      Serial.println("light be gone");
      digitalWrite(testLed, LOW);}


        
}
6  Using Arduino / Project Guidance / Re: Using Arduino to switch a light on on: January 24, 2012, 11:02:08 am
Thanks for your reply but I still don't know what the best way is to do something like this. Is my scheme correct or do I need other components like resistors?
7  Using Arduino / Project Guidance / Using Arduino to switch a light on on: January 23, 2012, 02:47:52 pm
Hello all,
I was wondering if it is possible to have an android phone send a command to arduino over bluetooth which than triggers a pulse to open/shut a valve for the duration of the button-press (on the phone). I want to use this to turn on multiple lights. The Arduino should work as a relais for the main power (if im correct).
I checked the web and I think it should be possible using the ADK board and a Bluetooth shield. What would be the best way to do it and what bluetooth component would be the best. 10 m is more than enough range for me..
To clarify my idea I made a visio drawing.
Here's the drawing

I found this bluetooth module online, is it ok for what I want? It does work with Arduino according to the comments:
http://www.dealextreme.com/p/wireless-bluetooth-rs232-ttl-transceiver-module-80711
Thanks for any help!! I really appreciate it!
Pages: [1]