Show Posts
Pages: [1]
1  Using Arduino / Sensors / Re: Ping sensor + Servo Motor problem on: November 11, 2011, 07:17:43 am
When i disconnect the servo , I receive the  correct results.. ( I think program works properly at least without servo smiley )

But something is really weird and I have no clue, I dont have 4 AAs therefore I just powered on another Arduino board and used +5v and ground pins to power up the servo, servo data pin hooked up the correct board as well. Now servo isnt working. I checked the second arduino pins by voltmeter, it looks normal .





2  Using Arduino / Sensors / Re: Ping sensor + Servo Motor problem on: November 11, 2011, 06:43:17 am
They both take power from the board. I mean Arduino..



3  Using Arduino / Sensors / Re: Ping sensor + Servo Motor problem on: November 11, 2011, 06:38:11 am
Thanks

I tried it  but still reading wrong values  on serial screen. At the very beginning, for once I read the distance but then i start to read only  "0-17-0-1-21-0"  like this. Still it doesn't work.

By the way I also use sensor shield , can it cause problem?

PS: I deleted the return statements..
4  Using Arduino / Sensors / Ping sensor + Servo Motor problem on: November 11, 2011, 05:59:59 am
Hi everyone,

 I have been trying to make a very simple project to get into the Arduino. There is  PING sensor on the servo motor, I want servo motor to turn 0-45-90-135-190 degrees and check the distance and I want to read  it on the serial screen. However I cant do it and cant figure it  out what the problem is..

I use 022 Ide, Arduino Mega,PING sensor and standard servo motor.

When i use them separetly, they work well but i cant make them work together..


And this is the program which doesnt work. (Servo turns but i cant read the distance.)

Code:
#include <Servo.h>

Servo Head;
int pingPin = 22; // ultrasonic sensor pin

void setup()
{
  Head.attach(3);
  Serial.begin(115200);
}

void Check_degree0()
{
  Head.write(15);
  delay(400);
  return ;
}

void Check_degree45()
{
  Head.write(35);
  delay(400);
  return ;
}

void Check_degree90()
{
  Head.write(80);
  delay(400);
  return ;
}

void Check_degree135()
{
  Head.write(125);
  delay(400);
  return ;
}

void Check_degree180()
{
   Head.write(175);
   delay(400);
   return ;
}

long Distance()
{
  long duration, cm;
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
  cm=duration/29/2;
  digitalWrite(pingPin, LOW);
  return cm;
}

void loop()

{
  Check_degree0();
  delay(1000);
  Serial.print(Distance());
  delay(100);
  Serial.print("\n");
  delay(100);
  
  Check_degree45();
  delay(1000);
  Serial.print(Distance());
  delay(100);
  Serial.print("\n");
  delay(100);
 
  Check_degree90();
  delay(1000);
  Serial.print(Distance());
  delay(100);
  Serial.print("\n");
  delay(100);
}


I hope someone can help me out..

Thanks

Moderator edit: Quote box exchanged for code box
5  Using Arduino / Sensors / Re: How to use URM04 v2 sensor with Arduino on: June 26, 2011, 04:07:58 am
Hi

johnwasser and robtillaart thank you for helping me solve the problem. It looks like I'm not able to do it at present. I better put it away and purchase a new one until I gain some experience.

johnwasser: I'm a bit confused about serial port using, I looked at the NewSoftSerial library but could't figure it out.

robtillaart: I tried to use the code block you posted and  I recieved the same letters. ( I changed only void serial_read block in orginial code. )

Could you recommend me any range finder sensor to use with Arduino. I'm thinking about getting Parallax Ping sensor http://www.parallax.com/tabid/768/ProductID/92/Default.aspx.

What are your opinions about this sensor? Also I'm open to recommendations.

Thank you very much.
Tugsan
6  Using Arduino / Sensors / How to use URM04 v2 sensor with Arduino on: June 23, 2011, 11:25:09 pm
Hello everyone,

As I am  new at Arduino, I have been having some problems with using URM04 sensor with Arduino . I have Arduino Uno and  I/O Expansion V5.0 . I'm using  the code which i got from   http://www.dfrobot.com/wiki/index.php?title=URM04_V2.0_%28SKU:SEN0002%29

However I can't read anything from the serial monitor. I tried different bauds (19200 and 115200 ) but still I'm reading strange letters like " UÂȘ".

Can anyone help about using this sensor. I'm not good at programing and just I want to use it simply. I dont need to read temparature, just wanna read the distance.

Thank you
Tugsan





Pages: [1]