Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: Wireless Temperature using Xbee on: July 27, 2012, 07:21:07 pm
"When I do something with an XBee I use a software serial port so I still have the serial port to debug with."

Can you point me in the right direction as to where I can find information regarding what you mention? Do I need to connect the Xbee at the TX and RX pins?
2  Using Arduino / Networking, Protocols, and Devices / Wireless Temperature using Xbee on: July 24, 2012, 07:14:44 pm
I have 2-Xbee's Series 2
           I-Arduino Uno
           1-Xbee shield
           1-Xbee explorer

I would like to see temperature values pop up on the serial monitor while using wireless communication. The temperature sensor is connected to the Xbee shield(with an Xbee attached) which is connected to the Arduino Uno. I then have the Xbee explorer attached to an Xbee connected to the computer. I can get values to show up on the serial monitor if I connect the Arduino Uno directly to the computer but not when using wireless communication. I have been able to turn on an led from the serial monitor having the same set up. I figured it would work both ways, receiving and sending information. Please help.

Here's the code.

Code:
//TMP36 Pin Variables
int sensorPin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade with a
                        //500 mV offset to allow for negative temperatures
 
/*
 * setup() - this function runs once when you turn your Arduino on
 * We initialize the serial connection with the computer
 */
void setup()
{
  Serial.begin(9600);  //Start the serial connection with the computer
                       //to view the result open the serial monitor
}
 
void loop()                     // run over and over again
{
 //getting the voltage reading from the temperature sensor
 int reading = analogRead(sensorPin); 
 
 // converting that reading to voltage, for 3.3v arduino use 3.3
 float voltage = reading * 5.0;
 voltage /= 1024.0;
 
 // print out the voltage
 Serial.print(voltage); Serial.println(" volts");
 
 // now print out the temperature
 float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((volatge - 500mV) times 100)
 Serial.print(temperatureC); Serial.println(" degrees C");
 
 // now convert to Fahrenheight
 float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
 Serial.print(temperatureF); Serial.println(" degrees F");
 
 delay(1000);                                     //waiting a second
}
3  Using Arduino / Programming Questions / Re: Sonar Car Trouble on: April 08, 2012, 10:46:58 am
There are no debug prints. I fixed the punctuation on the if and while. My new code is
Code:
//Arduino sonar car
#include <Ultrasonic.h>
#define TRIGGER_PIN  12
#define ECHO_PIN     13
Ultrasonic ultrasonic(TRIGGER_PIN, ECHO_PIN);
#include <Servo.h>
Servo myservo1;       
Servo myservo2;
Servo myservo3;
int pos = 0;
float cmMsec;

void setup()

  myservo1.attach(10,400,2400);
  myservo2.attach(9,400,2400);
  myservo3.attach(11); 

void loop()
{
do 
  {
    long microsec = ultrasonic.timing();
    cmMsec = ultrasonic.convert(microsec, Ultrasonic::CM);
    Serial.print(", CM: ");
    Serial.print(cmMsec); 
    delay(200);
  }
  while(cmMsec>15);
  {
    myservo1.writeMicroseconds(1400); //FORWARD
    myservo2.writeMicroseconds(1600);
    delay(1000);
    for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees
    {                                  // in steps of 1 degree
      myservo3.write(pos);              // tell servo to go to position in variable 'pos'
      delay(10);                       // waits 15ms for the servo to reach the position
    }
    for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
    {                               
      myservo3.write(pos);              // tell servo to go to position in variable 'pos'
      delay(10);                       // waits 15ms for the servo to reach the position
    }
    if(cmMsec<=15)
    {
      myservo1.writeMicroseconds(1600); //BACKWARD
      myservo2.writeMicroseconds(1400);
      delay(2000);       
      myservo1.writeMicroseconds(1400); //LEFT     
      myservo2.writeMicroseconds(1400);
      delay(1000);
    }
  }
}




Now the car waits for an object within 15cm to move forward and only reads it at the 0 degree mark(Right most). The car goes to its left if values are greater then 15cm. And there is are no values being printed. Everything that can go wrong is going wrong.
4  Using Arduino / Programming Questions / Re: Sonar Car Trouble on: April 08, 2012, 06:16:47 am
I been going over the code in my head and I thought that this should end up working.
Code:
//Arduino sonar car
#include <Ultrasonic.h>
#define TRIGGER_PIN  12
#define ECHO_PIN     13
Ultrasonic ultrasonic(TRIGGER_PIN, ECHO_PIN);
#include <Servo.h>
Servo myservo1;       
Servo myservo2;
Servo myservo3;
int pos = 0;
float cmMsec;

void setup()
{
 
  myservo1.attach(10,400,2400);
  myservo2.attach(9,400,2400);
  myservo3.attach(11); 


void loop()
{
  do
  {
  float cmMsec;
  long microsec = ultrasonic.timing();
  cmMsec = ultrasonic.convert(microsec, Ultrasonic::CM);
  Serial.print(", CM: ");
  Serial.print(cmMsec); 
  delay(200);
  }
  while(cmMsec<15);
  {
    myservo1.writeMicroseconds(1400); //FORWARD
       myservo2.writeMicroseconds(1600);
                delay(1000);
    for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees
    {                                  // in steps of 1 degree
      myservo3.write(pos);              // tell servo to go to position in variable 'pos'
      delay(100);                       // waits 15ms for the servo to reach the position
    }
    for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
    {                               
      myservo3.write(pos);              // tell servo to go to position in variable 'pos'
      delay(100);                       // waits 15ms for the servo to reach the position
    }
   if(cmMsec>=15);
    {
             myservo1.writeMicroseconds(1600); //BACKWARD
             myservo2.writeMicroseconds(1400);
                      delay(2000);       
             myservo1.writeMicroseconds(1400); //LEFT     
             myservo2.writeMicroseconds(1400);
                      delay(2000);
     }}}
 
 
   
 
 

My servos aren't rotating at all now. I have no idea why. This code seems like it should work.
5  Using Arduino / Programming Questions / Re: Sonar Car Trouble on: April 05, 2012, 12:40:24 am
(I will answer your questions to my best ability. I'm quite new to programming and only know the basics. I have been getting ideas from the samples I see around the net and use them to add them to my projects.)
1.Used to manipulate the frequency (in micro seconds) as which I would like to see measurements.
2. Makes it so that the HC-SR04 sends the pulse and measure the amount of time taken to return to get the distance.
3. Tells the servo to rotate with a certain speed in one direction. 1500 being no movement. One is 1400 and the other is 1600 because the servos are opposite in the way they have been positioned.
4. Approximately 2cm-500cm
5. Effectual angle is <15°

I am extremely appreciative of the time you are taking to view my project. You really don't know how much this means to me. Thought you should know.
6  Using Arduino / Programming Questions / Re: Sonar Car Trouble on: April 04, 2012, 10:18:23 pm
I look forward to your reply.
7  Using Arduino / Programming Questions / Sonar Car Trouble on: April 04, 2012, 08:49:01 pm
I am working on a project using the Arduino Duemilanove, make/mshield(motor shield), 2 continuous parallax servos, 1 T pro 9gram 180 degree servo, and a HC-SR04 sonar sensor. The 2 parallax continuous servos are used to make the car move left, right, backward, and forward. The  HC-SR04 sonar sensor is mounted on top of the rotating(right to left) T pro 9gram 180 degree servo. I want the car to avoid objects. When detecting an object I would like the car to go backward and then make a left to switch its path. So far I can get the car to move forward until it senses an object on its right hand side(within 25cm), it then moves back and moves to its left. I can't get the sensor to measure values while the T pro 9gram 180 degree servo is rotating, only while it's at degree 0. Another problem is that when it does detect an object on its right hand side, it makes a left for more than the time allotted(In the first code).  In the second code I can get the car to do the same task except that now it does return measurements, except that they are all identical to the first measurement. I've tried the first code with many adjustments along the way leading to the second code posted and so far I think that maybe whoever reads this post can work with these codes. I would like for someone to please tell me how to also get the T pro 9gram 180 degree servo to rotate while the HC-SR04 sensor gives readings throughout its rotation, therefore alerting the program that there may be on object at some angle other than 0,90, or 180 all while always moving forward until an object is detected. [/img]
Code:
//Arduino sonar car code 1
#include <Ultrasonic.h>
#define TRIGGER_PIN  12
#define ECHO_PIN     13
Ultrasonic ultrasonic(TRIGGER_PIN, ECHO_PIN);
#include <Servo.h>
Servo myservo1;       
Servo myservo2;
Servo myservo3;
int pos = 0;

void setup()
{
  Serial.begin(9600);
  myservo1.attach(10,544,2400);
  myservo2.attach(9,544,2400);
  myservo3.attach(11); 


void loop()
{ float cmMsec, inMsec;
  long microsec = ultrasonic.timing();
  cmMsec = ultrasonic.convert(microsec, Ultrasonic::CM);
  Serial.print(", CM: ");
  Serial.print(cmMsec); 
delay(200);
 
  for(pos = 0; pos < 180; pos += 1)
    {                                 
      myservo3.write(pos);               
      delay(5);                     
    }
    for(pos = 180; pos>=1; pos-=1)     
    {                               
      myservo3.write(pos);             
      delay(5);                       
    }
        if(cmMsec<15)
          {
             myservo1.writeMicroseconds(1600); //BACKWARD
             myservo2.writeMicroseconds(1400);
                      delay(2000);       
             myservo1.writeMicroseconds(1400); //LEFT     
             myservo2.writeMicroseconds(1400);
                      delay(2000);
           }   

        else   
          {
             myservo1.writeMicroseconds(1400); //FORWARD
             myservo2.writeMicroseconds(1600);
                      delay(50);
           }
             
}

 
 
 

and

Code:
//Arduino sonar car
#include <Ultrasonic.h>
#define TRIGGER_PIN  12
#define ECHO_PIN     13
Ultrasonic ultrasonic(TRIGGER_PIN, ECHO_PIN);
#include <Servo.h>
Servo myservo1;       
Servo myservo2;
Servo myservo3;
int pos = 0;

void setup()
{
  Serial.begin(9600);
  myservo1.attach(10,544,2400);
  myservo2.attach(9,544,2400);
  myservo3.attach(11,250,1200); 


void loop()
{
  for(pos = 0; pos < 90; pos += 1)  // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo3.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  float cmMsec;
  long microsec = ultrasonic.timing();
  cmMsec = ultrasonic.convert(microsec, Ultrasonic::CM);
  Serial.print(", CM: ");
  Serial.print(cmMsec); 
  delay(200);


  if(cmMsec>25)
  {
    //FORWARD
    myservo1.writeMicroseconds(1400);
    myservo2.writeMicroseconds(1600);
    delay(500);   
  }
  if(cmMsec<25)
  { //BACKWARD
    myservo1.writeMicroseconds(1600);
    myservo2.writeMicroseconds(1400);
    delay(4000);       
    myservo1.writeMicroseconds(1400); //LEFT     
    myservo2.writeMicroseconds(1400);
    delay(200);
  }
 
  delay(2000);
for(pos = 90; pos < 180; pos += 1)     // goes from 180 degrees to 0 degrees
  {                               
    myservo3.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);
  }
  cmMsec = ultrasonic.convert(microsec, Ultrasonic::CM);
  Serial.print(", CM: ");
  Serial.print(cmMsec); 
  delay(200);
  if(cmMsec>25)   
  { //FORWARD
    myservo1.writeMicroseconds(1400);
    myservo2.writeMicroseconds(1600);
    delay(500);
  }
  if(cmMsec<25)
  { //BACKWARD
    myservo1.writeMicroseconds(1600);
    myservo2.writeMicroseconds(1400);
    delay(4000);       
    myservo1.writeMicroseconds(1400); //LEFT     
    myservo2.writeMicroseconds(1400);
    delay(200);
  }
 
  delay(2000);
for(pos = 180; pos > 90; pos -= 1)     // goes from 180 degrees to 0 degrees
  {                               
    myservo3.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);
  }
  cmMsec = ultrasonic.convert(microsec, Ultrasonic::CM);
  Serial.print(", CM: ");
  Serial.print(cmMsec); 
  delay(200);
        // waits 15ms for the servo to reach the position
 
  if(cmMsec>25)
  {//FORWARD
    myservo1.writeMicroseconds(1400);
    myservo2.writeMicroseconds(1600);
    delay(500);
  }
  if(cmMsec<25)
  {
    myservo1.writeMicroseconds(1600); //BACKWARD
    myservo2.writeMicroseconds(1400);
    delay(4000);       
    myservo1.writeMicroseconds(1400); //LEFT     
    myservo2.writeMicroseconds(1400);
    delay(200);
  }
  delay(2000);
for(pos = 90; pos > 0; pos -= 1)     // goes from 180 degrees to 0 degrees
  {                               
    myservo3.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);      // waits 15ms for the servo to reach the position
  }
  cmMsec = ultrasonic.convert(microsec, Ultrasonic::CM);
  Serial.print(", CM: ");
  Serial.print(cmMsec); 
  delay(200);
   
  if(cmMsec>25)
  {
    //FORWARD
    myservo1.writeMicroseconds(1400);
    myservo2.writeMicroseconds(1600);
    delay(500);
  }
  if(cmMsec<25)
  {
    myservo1.writeMicroseconds(1600); //BACKWARD
    myservo2.writeMicroseconds(1400);
    delay(4000);       
    myservo1.writeMicroseconds(1400); //LEFT     
    myservo2.writeMicroseconds(1400);
    delay(200);
  }
  delay(1000);
 


}








8  Using Arduino / Programming Questions / Controlling 2 servos with an acceleromoter on: January 28, 2012, 11:26:21 pm
I'm using the ADXL355 acceleromoter to control 2 servos with a right,left,up,down motion. For some reason unknown to me, only servo2 is working. Can anyone tell me why only one servo is responding? (I switched the servos to test if they worked individually, and they both worked)
Code:
//ARDUINO CAR 2 Motors(Controlled in realtime by moving the ADXL3XX
#include <Servo.h>
Servo servo1;          //declare servos
Servo servo2;
int pos1 = 0;
int pos2 = 0;
const int xPin = 0;
const int yPin = 1;
const int zPin = 2;
void setup()
{
  Serial.begin(9600);
  servo1.attach(9);
  servo1.write(90);
  servo2.attach(10);
  servo2.write(90);         
  Serial.println("Time to take control!!!!"); 
}
void loop()

 
//Foward
 if((analogRead(xPin)<310) &&         
    (analogRead(zPin)<405))
    {Serial.print("Foward");
    servo2.write(pos2+45);
  }   
                     delay(500);
//Backward   
 if((analogRead(xPin)>390) &&   
    (analogRead(zPin)<405))
    {Serial.print("Backward");
    servo2.write(pos2-45); }   
                     delay(500);
//Left   
 if((analogRead(yPin)<292) &&
    (analogRead(zPin)<405))
    {Serial.print("Left");
     servo1.write(pos1-45); }   
                     delay(500);
//Right                     
 if((analogRead(yPin)>396) &&
    (analogRead(zPin)<390))
    {Serial.print("Right");
     servo1.write(pos1+45); }   
                     delay(500);
                     
}

9  Using Arduino / Programming Questions / Re: Distance Program on: July 31, 2011, 06:51:39 pm
Hey David if I want to recall stored names for example
Code:
{
      {0,0,0,0,0,0,0},
      {0,'saturn','mercury','urunus','sun','earth','pluto'},
      {0,'notes','delete','sum','ligit','monkey','money'},
      {0,'nail','nail','destroy','laugh','rich','plant'},
      {0,'bed','clock','drapes','fallacies','click','door'},
      {0,'mouse','spoon','dog','toes','head'},
      {0,'elephant','table','mouse','star','ratio','magic'},
     
    };
What would I have to do?
10  Using Arduino / Programming Questions / Re: Distance Program on: July 31, 2011, 04:51:35 pm
No I want it to print out the corresponding word  in the array
Code:
char distance(char room1,char room2)
  {
    char distance[7][7]=
    {
      {0,0,0,0,0,0,0},
      {0,'saturn','mercury','urunus','sun','earth','pluto'},
      {0,'notes','delete','sum','ligit','monkey','money'},
      {0,'nail','nail','destroy','laugh','rich','plant'},
      {0,'bed','clock','drapes','fallacies','click','door'},
      {0,'mouse','spoon','dog','toes','head'},
      {0,'elephant','table','mouse','star','ratio','magic'},
     
    };
    return distance [room1][room2];
  }
I'm not sure how to make that happen correctly though
11  Using Arduino / Programming Questions / Re: Distance Program on: July 31, 2011, 04:26:12 pm
The random letter (random to me at least) shows up after I enter in starting and ending location. That would be the amount of feet if it were the original distance program. For example if my starting distance is 2 and the ending distance is 3, the word that shows up is m. The first program prints the words in regards to location and at the end it prints out the distance in feet. There really isn't a problem. i just want to learn how to print out words instead of number in the 2d array. I'm using the Duemilanove.
12  Using Arduino / Programming Questions / Re: Distance Program on: July 31, 2011, 03:53:01 pm
I put this code up but I only get one letter back which is not related to the word.
Code:
//Distance Program
void setup()
{
Serial.begin(9600);
Serial.print("Distance Program\n\n\n\n\n");
delay(3000);
}
void loop()
{
  int startPoint=NULL;
  int endPoint=NULL;
 
  Serial.print("Select the Starting Location(enter # value) \n");
  menu();
  getInput(startPoint);
  Serial.print("Your Starting Location is ");
  displayInput(startPoint);
 
  Serial.print("Select the Ending Location(enter # value)\n");
  menu();
  getInput(endPoint);
  Serial.print("Your Ending Location is  ");
  displayInput(endPoint);
 
  Serial.print("Your Total Distance is\n");
  char feet=distance(startPoint,endPoint);
  Serial.print(feet);
  Serial.print("feet");
  Serial.print("\n\n\n\n\n\n\n");
}
 
 
 
 
 
 
  void menu()
  {
    delay(2000);
    Serial.print("1 - Gerardo's Room\n");
    Serial.print("2 - Living Room\n");
    Serial.print("3 - Kitchen\n");
    Serial.print("4 - Bathroom\n");
    Serial.print("5 - Marta's room\n");
    Serial.print("6 - Laurice's House\n");
    Serial.print("\n\n\n");
  }
 
  void getInput(int& number)
  {
    do
    {
      delay(500);
      if(Serial.available())
      {
        number=Serial.read()-48;
      }
      if((number<0))
      {
      }
      else if(number>6)
      {
        Serial.print(number);
        Serial.print("\n# Must Be from 1-6\n");
        number=NULL;
      }
    }
    while ((number<0) || (number>6) || (number==NULL));
  }
 
  void displayInput(int selection)
  {
    switch (selection)
    {
    case 1:
    Serial.print("Gerardo's Room\n");
    break;
    case 2:
    Serial.print("Living Room\n");
    break;
    case 3:
    Serial.print("Kitchen\n");
    break;
    case 4:
    Serial.print("Bathroom\n");
    break;
    case 5:
    Serial.print("Marta's room\n");
    break;
    case 6:
    Serial.print("Laurice's House\n");
    break;
    }
  }
 
  char distance(char room1,char room2)
  {
    char distance[7][7]=
    {
      {0,0,0,0,0,0,0},
      {0,'saturn','mercury','urunus','sun','earth','pluto'},
      {0,'notes','delete','sum','ligit','monkey','money'},
      {0,'nail','nail','destroy','laugh','rich','plant'},
      {0,'bed','clock','drapes','fallacies','click','door'},
      {0,'mouse','spoon','dog','toes','head'},
      {0,'elephant','table','mouse','star','ratio','magic'},
     
    };
    return distance [room1][room2];
  }
   
   
   
   
13  Using Arduino / Programming Questions / Distance Program on: July 31, 2011, 03:32:39 pm
Hello, I made a program with the help of the Arduino forum members. I now want to have words printed instead of distances. What Do I need to do in order for this to work?

this is the distance program
Code:

//Distance Program
void setup()
{
Serial.begin(9600);
Serial.print("Distance Program\n\n\n\n\n");
delay(3000);
}
void loop()
{
  int startPoint=NULL;
  int endPoint=NULL;
 
  Serial.print("Select the Starting Location(enter # value) \n");
  menu();
  getInput(startPoint);
  Serial.print("Your Starting Location is ");
  displayInput(startPoint);
 
  Serial.print("Select the Ending Location(enter # value)\n");
  menu();
  getInput(endPoint);
  Serial.print("Your Ending Location is  ");
  displayInput(endPoint);
 
  Serial.print("Your Total Distance is\n");
  int feet=distance(startPoint,endPoint);
  Serial.print(feet);
  Serial.print("feet");
  Serial.print("\n\n\n\n\n\n\n");
}
 
 
 
 
 
 
  void menu()
  {
    delay(2000);
    Serial.print("1 - Gerardo's Room\n");
    Serial.print("2 - Living Room\n");
    Serial.print("3 - Kitchen\n");
    Serial.print("4 - Bathroom\n");
    Serial.print("5 - Marta's room\n");
    Serial.print("6 - Laurice's House\n");
    Serial.print("\n\n\n");
  }
 
  void getInput(int& number)
  {
    do
    {
      delay(500);
      if(Serial.available())
      {
        number=Serial.read()-48;
      }
      if((number<0))
      {
      }
      else if(number>6)
      {
        Serial.print(number);
        Serial.print("\n# Must Be from 1-6\n");
        number=NULL;
      }
    }
    while ((number<0) || (number>6) || (number==NULL));
  }
 
  void displayInput(int selection)
  {
    switch (selection)
    {
    case 1:
    Serial.print("Gerardo's Room\n");
    break;
    case 2:
    Serial.print("Living Room\n");
    break;
    case 3:
    Serial.print("Kitchen\n");
    break;
    case 4:
    Serial.print("Bathroom\n");
    break;
    case 5:
    Serial.print("Marta's room\n");
    break;
    case 6:
    Serial.print("Laurice's House\n");
    break;
    }
  }
 
  int distance(int room1,int room2)
  {
    int distance[7][7]=
    {
      {0,0,0,0,0,0,0},
      {0,0,15,18,23,25,317441},
      {0,15,0,27,32,34,17424},
      {0,18,27,0,13,15,17451},
      {0,23,32,13,0,6,17456},
      {0,25,34,27,6,0,17458},
      {0,17441,17424,17451,17456,17458,0},
     
    };
    return distance [room1][room2];
  }
   
   
 

This is what I would like it to look like with the words
Code:
//Distance Program
void setup()
{
Serial.begin(9600);
Serial.print("Distance Program\n\n\n\n\n");
delay(3000);
}
void loop()
{
  int startPoint=NULL;
  int endPoint=NULL;
 
  Serial.print("Select the Starting Location(enter # value) \n");
  menu();
  getInput(startPoint);
  Serial.print("Your Starting Location is ");
  displayInput(startPoint);
 
  Serial.print("Select the Ending Location(enter # value)\n");
  menu();
  getInput(endPoint);
  Serial.print("Your Ending Location is  ");
  displayInput(endPoint);
 
  Serial.print("Your Total Distance is\n");
  char feet=distance(startPoint,endPoint);
  Serial.print(feet);
  Serial.print("feet");
  Serial.print("\n\n\n\n\n\n\n");
}
 
 
 
 
 
 
  void menu()
  {
    delay(2000);
    Serial.print("1 - Gerardo's Room\n");
    Serial.print("2 - Living Room\n");
    Serial.print("3 - Kitchen\n");
    Serial.print("4 - Bathroom\n");
    Serial.print("5 - Marta's room\n");
    Serial.print("6 - Laurice's House\n");
    Serial.print("\n\n\n");
  }
 
  void getInput(int& number)
  {
    do
    {
      delay(500);
      if(Serial.available())
      {
        number=Serial.read()-48;
      }
      if((number<0))
      {
      }
      else if(number>6)
      {
        Serial.print(number);
        Serial.print("\n# Must Be from 1-6\n");
        number=NULL;
      }
    }
    while ((number<0) || (number>6) || (number==NULL));
  }
 
  void displayInput(int selection)
  {
    switch (selection)
    {
    case 1:
    Serial.print("Gerardo's Room\n");
    break;
    case 2:
    Serial.print("Living Room\n");
    break;
    case 3:
    Serial.print("Kitchen\n");
    break;
    case 4:
    Serial.print("Bathroom\n");
    break;
    case 5:
    Serial.print("Marta's room\n");
    break;
    case 6:
    Serial.print("Laurice's House\n");
    break;
    }
  }
 
  char distance(char room1,char room2)
  {
    char distance[7][7]=
    {
      {0,0,0,0,0,0,0},
      {0,saturn,mercury,urunus,sun,earth,pluto},
      {0,notes,delete,sum,ligit,monkey,money},
      {0,nail,nail,destroy,laugh,rich,plant},
      {0,bed,clock,drapes,fallacies,click,door},
      {0,mouse,spoon,dog,toes,head},
      {0,elephant,table,mouse,star,ratio,magic},
     
    };
    return distance [room1][room2];
  }
   
   
   
   
14  Using Arduino / Programming Questions / Re: Distance Program on: July 31, 2011, 04:13:57 am
David, Thank you very much. You just opened many doors for me. It's 2:10am and I have the biggest smile on my face. Thanks for your time and knowledge. Thanks for helping me out. I'm very happy!!! lol Thanks again!!!!
Wow I can't believe it works!!!
Your the best

Truth Passion Peace and Love
15  Using Arduino / Programming Questions / Re: Distance Program on: July 31, 2011, 02:58:23 am
That's exactly how to describe it. You can try it on your arduino and see that the only thing left is to display that distance. Is the table function the same as an 2d array? There are so many things I don't know about programming
Pages: [1] 2