Thread: SRF02 ultrasonic sensor

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    1

    SRF02 ultrasonic sensor

    Hello guys. I'm having a difficult time trying to figure out how to display SRF02 ultrasonic sensor values in inches. Does anyone have a solution?
    This is what I have written:

    int frontSensor;
    int leftSensor;

    while(1)
    {
    frontSensor = getUltrasonicSensorReading();
    printf("$Ultrasonic:%3i inches ", frontSensor);
    leftSensor = readADC_PORTA_Wire(0);
    printf(" $Ultrasonic:%3i\n", leftSensor);

    frontSensor = (leftSensor - 176.67)/(-14.714);

    fprintf(&cpu1Out, "CPU1: $Ultrasonic:%3i inches, left sensor = %3i\n", frontSensor, leftSensor);
    printf("Hercules:$Ultrasonic:%3i inches, left sensor = %3i\n", frontSensor, leftSensor);
    delay_ms(250);
    }
    Last edited by quachtinh; 11-13-2009 at 02:53 AM.

  2. #2
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    What's the problem, specifically?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client Server sensor - sink
    By Nemerniku in forum Networking/Device Communication
    Replies: 0
    Last Post: 06-18-2009, 08:49 AM
  2. How to get RSSI value, send to sensor, sensor receive package, repackage it?
    By techissue2008 in forum Networking/Device Communication
    Replies: 1
    Last Post: 03-04-2009, 10:13 AM
  3. Reading values from a chart and creating a new one
    By sackyhack in forum C++ Programming
    Replies: 6
    Last Post: 08-25-2005, 04:53 PM
  4. Problem coding Banner sensor interrupt...
    By processing in forum C Programming
    Replies: 1
    Last Post: 02-14-2005, 04:41 PM