Show Posts
Pages: [1] 2 3
1  Using Arduino / Programming Questions / Re: Serial output float array~(Help) on: August 05, 2011, 11:56:24 am
I want to output the array, I mean, not one by one, but the whole array.
 I have found a way now, I know it's impossble to output a float array once(just the char array can do that). So I firstly converse the float type to String(using the dtostrf() method), then connect the many String together to one String, then output the long String. So that I can get the whole array.

Thanks for you attention.
Quote from: robtillaart link=topic=68545.msg505600#msg505600 date=1312556312

Can you manually type in how you would like your output?
[/quote
2  Using Arduino / Programming Questions / Serial output float array~(Help) on: August 05, 2011, 09:21:30 am
Hi there,

I am doing a project recently, it's about control a robot remotely and get the distance (taken by a distance sensor) back to the client interface.

As you can see, one of the functions is to get the distance number, my design is : when the servo motor under the distance sensor sweeps, it get the according distance. For example, when the angle is 0, get 23.44, when it sweeps and the angle is 20, get distance 34.22... I transport the angle and the distance number by Serial.print() function.
Following is my code about get the distance number and sweep servo and then Serial.print the numbers.
Code:
//**************************** DISTANCE SENSOR **************************************************
float distanceReturn() {
  float volts = analogRead(IRpin)*0.0048828125;   // value from sensor * (5/1024) - if running 3.3.volts then change 5 to 3.3
   distance = 65*pow(volts, -1.10);          // worked out from graph 65 = theretical distance / (1/Volts)S - luckylarry.co.uk

 // Serial.println(distance);                       // print the distance
   return distance;
  //delay(1000);                                     // arbitary wait time.
}

//**************************** SERVO SWEEP ROUTINE **************************************************
void sweep()
{
    float d[19];
    float p[19];
for(pos = 0; pos <= 180; pos += 10) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myServo.write(pos); // tell servo to go to position in variable 'pos'
  d[pos/18]=distanceReturn();
  Serial.print(pos);
  Serial.print(" -- ");
  Serial.println(d[pos/18]);
delay(105); // waits 105ms for the servo to reach the position
}
delay(1000);
for(pos = 180; pos>=0; pos-=10) // goes from 180 degrees to 0 degrees
{
myServo.write(pos); // tell servo to go to position in variable 'pos'
  d[pos/18]=distanceReturn();
  Serial.print(pos);
    Serial.print(" -- ");
  Serial.println(d[pos/18]);
delay(105); // waits 105ms for the servo to reach the position
}
}

My question is, now it's output the pair(distance and angle) one by one, but I want to print them like a package, namely, I want print the angle(from 0~180) and the according distance together.
I tried array, but don't know how to output a whole array, is there any method like Serial.print(d)? If not, how can output the 19 pairs numbers to the client?

Sorry my English is poor, if it's not clear about the question, please talk to me and I'll try to make it clear.
Thank you in advance!
3  Using Arduino / Project Guidance / Re: Remote control and monitor by a robot and camera over internet? on: July 31, 2011, 02:23:27 pm
Thank you for the link, now I have build the remote system with a distance sensor, (using socket for internet transport and xbee for wireless control), now I can remotely control my robot over internet and also get the distance number from my sensor, my only problem is to buy a network camera for monitoring, but I don't know if your link can fulfil my requirement, I think maybe I need a smaller one. Do you know something like that (which can be embedded on a servo motor on a robot)?

I have three of these that I am monitoring remotely over the Internet. There is a fairly active community involved with the use and hacking of this platform.
http://foscam.us/products/foscam-fi8905w-outdoor-wireless-ip-camera-23.html
They run an imbedded web server with an extensive cgi interface to the camera. If you can get away with an indoor model, it has pan and tilt control.
4  Using Arduino / Project Guidance / Re: Remote control and monitor by a robot and camera over internet? on: July 29, 2011, 09:14:06 am
Could you give me some links about this kind of cameras? I want to order a camera that can  directly get videos by java. Thank you~~

You could bypass many of those steps just by using an 802.11g/n wifi camera with a built in web-server; slightly more expensive, sure - but much more "plug-n-play"...
5  Using Arduino / Sensors / Re: Distance Sensor(plz help) on: July 25, 2011, 08:25:16 pm
Thank you very much, I think I have to order a new one. smiley-cry smiley-cry smiley-cry smiley-cry smiley-cry
I think you're in trouble. From what I can tell from the data sheet, that sensor is designed to tell when something comes within 800mm. It has a digital output, either one or zero depending on whether or not an object is within its detection range. From your previous comments I don't think that is what you want at all. I don't see any option but to order a different sensor.
6  Using Arduino / Sensors / Re: Distance Sensor(plz help) on: July 25, 2011, 08:23:12 pm
Thank you everyone for the links and helps, does someone know if a digital distance sensor can measure the distance between the sensor and the obstacle?
If not, I must to order a new one quickly, I'm quite anxious about this as time is limited, please help me !!
7  Using Arduino / Sensors / Re: Distance Sensor(plz help) on: July 25, 2011, 07:59:09 pm
Sorry I didn't check the forum these days, I know a analog one will be better now, and nearly every example online is about analog.
But unfortunately, I have ordered the digital one and it has come to me.(My tutor ordered it for me and the day I post this topic is the day I have to decide which to buy) I am a newbie and this is the first time to do the hardware things, I feel sad to get the wrong one but seems have no time to change, do you know how to get the distance number of this digital sensor? http://ie.farnell.com/sharp/gp20d02yk0f/sensor-distance-digital-o-p/dp/9707905

Quote
maybe digital is better as it can record the numbers, right?
Maybe it isn't better.
Imagine being ordered to measure a room with a stick you have been told is 800mm long (though it may be as short as 700mm or as long as 900mm).
You can only measure things as being "more than a stick" or "less-than-or-equal-to a stick".

Do you think you'll be able to achieve that with your robot? (which you still haven't told us any more about)
8  Using Arduino / Sensors / Re: How to connect LDR to arduino?(HELP) on: July 21, 2011, 10:17:39 am
I have got a breadboard, but with no resistor, do I have to get one, why?

Well as already drawn for you:

Quote
TO connect an LDR correctly it must be part of a voltage divider

+5V ---- [ LDR ] -----* ------[Resistor] ----- GND

So, one end of the LDR goes to a +5vdc pin, one end of the resistor goes to a ground pin. Now the problem, the other ends of both the LRD and resistor must connect to the analog input pin you are using. As usually two wires won't fit into one pin hole, and you don't want to use a breadboard, then you must solder the connection between the LRD and resistor and then add a single wire from that junction connection to the analog input pin.

Lefty


9  Using Arduino / General Electronics / Re: A xbee project(what do I need?) on: July 20, 2011, 10:29:49 am
Thank you Mark,could you have a look at this:http://ie.farnell.com/digi-international/xa-a14-ce1p/adapter-xbeepro-2-5-802-15-4/dp/1690793 will this be suitable to act as a adapter to the computer?


 The link you provided is not what you want to connect to an Arduino. I looked over the Radionics site and did not find a kit that has what you need. They do have Xbee transmitters and receivers but, not the parts to connect directly to the Arduino.

 Can you state what country you live in? Maybe someone from your area can give you the best place to look.

Mark
 

Can I use this shield to connect to my Arduino, http://ie.farnell.com/arduino/a000021/board-arduino-xbee-shield-w-o-module/dp/1848697
and buy the link provided above?


 The farnell link shows what MIGHT be the shield you need for the Arduino. You will still need 2 Xbee's and some way to connect to the computer. I would like to help you more but, I am not 100% certain on what parts you need from Farnell and I don't want to cost you extra money if I am wrong.

Mark

10  Using Arduino / Sensors / Re: Distance Sensor(plz help) on: July 20, 2011, 10:10:28 am
Only you can answer the question "which would be more suitable", based on the requirements you have, which you didn't share.

It's my first time to do this so I'm not clear about it, I have to record the distance and draw a map according to the distance, yep, maybe digital is better as it can record the numbers, right?
11  Using Arduino / Sensors / Re: Distance Sensor(plz help) on: July 20, 2011, 09:57:30 am
My understanding is that the digital versions have a fixed sensing distance - the object is either in-range or it isn't.
Unless the platform is moving, and has an accurate position reference, this doesn't seem too useful for mapping purposes.

Thanks, but I am still confused, will a analog sensor be better? the distance sensor will be embedded on a mobile robot, the robot  and the sensor can both move.
12  Using Arduino / Sensors / Distance Sensor(plz help) on: July 20, 2011, 09:24:35 am
Hi everyone,

I'm going to do a project that can draw a map according to the distance measured by a distance sensor. The distance sensor will be connect to an arduino and controlled by the computer through the xbees.
This is the distance sensor I found : http://ie.farnell.com/sharp/gp20d02yk0f/sensor-distance-digital-o-p/dp/9707905

My question is: it seems there are two types of distance sensor, the digital and the analog . Which may be more suitable for my project?
Also how can I connect the distance sensor to my arduino?(Physically)

I have to order it today, so please help~~

Thank you very much
13  Using Arduino / General Electronics / Re: A xbee project(what do I need?) on: July 18, 2011, 05:14:07 pm

 The link you provided is not what you want to connect to an Arduino. I looked over the Radionics site and did not find a kit that has what you need. They do have Xbee transmitters and receivers but, not the parts to connect directly to the Arduino.

 Can you state what country you live in? Maybe someone from your area can give you the best place to look.

Mark
 

Can I use this shield to connect to my Arduino, http://ie.farnell.com/arduino/a000021/board-arduino-xbee-shield-w-o-module/dp/1848697
and buy the link provided above?
14  Using Arduino / Sensors / Re: How to connect LDR to arduino?(HELP) on: July 18, 2011, 02:13:44 pm
a) Get some breadboards! There's a nice one available from....

http://wulfden.org/TheShoppe/accessories.shtml
($6, incl p&p to USA)


Thank you for your reply, but I don't want to use a breadboard, I want to know if I can connect them together without a breadboard?
15  Using Arduino / Sensors / Re: How to connect LDR to arduino?(HELP) on: July 18, 2011, 02:11:35 pm
If the leads are long enough you could just poke them into the appropriate header holes. If not extend them with some wire soldered on.

______
Rob

Could you please tell me which leads should poke into which header holes?
Pages: [1] 2 3