Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: pls help with different value from function on: January 26, 2013, 03:55:04 pm
you are right!
I was sure i was trying this also before, but now with int d=0; works.

Thx! If i come to Texas one time, i spend you a beer  smiley
2  Using Arduino / Programming Questions / Re: pls help with different value from function on: January 26, 2013, 03:39:55 pm
return 112 without Serial.print.
return 10 with Serial.print...

i am a little confused the last hours  smiley-eek
3  Using Arduino / Programming Questions / Re: pls help with different value from function on: January 26, 2013, 02:53:04 pm
thx, but is not.
All Code is same, but if i have Serial.println in the function to print the value i revice 7 for Example.
If Serial.println is commentet with // i recive 125 f.e.  smiley-roll
4  Using Arduino / Programming Questions / pls help with different value from function on: January 26, 2013, 02:43:25 pm
Hi all, pls help i dont find the problem.
I read rom a photodiode which is in combination with some ir leds.
Works in general but now i got some fault and i cant figure out....
here is the code:
Code:
int IRpin = A0;               // IR photodiode on analog pin A0
int IRemitter = 2;            // IR emitter LED on digital pin 2
int ambientIR;                // variable to store the IR coming from the ambient
int obstacleIR;               // variable to store the IR coming from the object               // variable to store the IR values
int distance;   

int do_print=1;// variable that will tell if there is an obstacle or not


void setup(){
  if (do_print == 1)
  Serial.begin(9600);         // initializing Serial monitor
  pinMode(IRemitter,OUTPUT);  // IR emitter LED on digital pin 2
  digitalWrite(IRemitter,LOW);// setup IR LED as off
}

void loop(){
  distance = IR_value(5);       // calling the function that will read the distance and passing the "accuracy" to it

  if (do_print == 1)
  Serial.println(distance); //writing the read value on Serial monitor
  if (do_print == 1) delay(1000);
}

int IR_value(int c)
{
  int d;
  for(int x=0;x<c;x++){     

    digitalWrite(IRemitter,LOW);
    delay(3);
    ambientIR = analogRead(IRpin);
    digitalWrite(IRemitter,HIGH);
    delay(3);
    obstacleIR = analogRead(IRpin);
    d = d+ (obstacleIR-ambientIR);
  }
  int result=(d/c);
  //Serial.println(result);
  return result;
}


but if i dis-comment the serial.println in the function, i recive another value for the result. i was testing on 2 different pcs, same issue.
Any one who point me tho the failure?

thx and best regards,
Rudi
5  Using Arduino / Sensors / Re: Idea needed for hidden Target on: January 10, 2013, 04:23:07 am

Kind of like ham radio operators and fox hunts?


Yes, something like this. Everyone is building his own robort. We hide the target somewhere in the room, also hidden, and which robot is finding first the hidden target is the winner :-)

Any suggestions and hints? Important is that the target dosn't have direct view to the robots ...
6  Using Arduino / LEDs and Multiplexing / Re: recognize if a led is connected on a digital out on: January 10, 2013, 03:16:18 am
thx all, i will give a try to this solutions!

Nice day, Rudi
7  Using Arduino / LEDs and Multiplexing / Re: recognize if a led is connected on a digital out on: January 09, 2013, 10:36:35 am
Heres a plan that might work to see if your sensor box is plugged in :-

If you run the LED from an Analog pin  , which is set to input,  and high ( so as to set its pullup resistor )  you could then AnalogRead the voltage on the pin.

If there is no LED to ground you will get 5v,  but if the LED ( red?) is connected you will see 2v.

The LED will probably glow from the current of the pull-up resistor, but once you have established the LED is there, you can switch the pin back to output to turn on the LED when you want.


Great! thank you!
8  Using Arduino / LEDs and Multiplexing / Re: recognize if a led is connected on a digital out on: January 09, 2013, 10:15:27 am
What are you trying to do  Rudi ?

After reset i need to initialize if some sensors are connectet or not. this is important for the code in the loop.
A Connector in this case is a small box, one type is an LDR with an Control LED, other is a hall sensor with a Controll led.
In the loop i wait for input of one of this sensor boxes, selected by random.
In the selected box the led is on, for the user to see whats the next box

All is a game for R/C

So, before i initialize my "Random Machine" i need to know how much of this Sensors/LEDs are connected to the Arduino.

Thanks!
9  Using Arduino / LEDs and Multiplexing / recognize if a led is connected on a digital out on: January 09, 2013, 04:58:01 am
Hi all,

is there a simple way in the setup to recognize if a led is connected on a digital out?

Thanks for any hints,
Rudi
10  Using Arduino / Programming Questions / Re: digitalwrite(3, HIGH) 1.5Vdc instead of 5Vdc on: January 09, 2013, 04:34:07 am
pinMode(led3, OUTPUT); check
int led3 = 3; check
digitalWrite(led3, HIGH); check

must no be

int led3 = 3; check
pinMode(led3, OUTPUT); check
digitalWrite(led3, HIGH); check

?
11  Using Arduino / Sensors / Idea needed for hidden Target on: January 09, 2013, 03:35:16 am
Hi all,
first sorry for my english, i am nativ german ...

Maybe someone can point me to the right direction:
i have a small robot based on arduino.
Now i want to make a "target", means to hide a small box somewhere in the room and the robot need to locate.
IR sensor dont want because maybe the robot can not see the target (behind a wall for example).
Sound i dont want because the target is maybe hidden for longer time and no one want to her the piep piep for few hours :-)

Any suggestions what type of sensor i can use for the hidden target?

Thanks in Advance and best regards from austria
Pages: [1]