SRF02 ultrasonic sensor

This is a discussion on SRF02 ultrasonic sensor within the C Programming forums, part of the General Programming Boards category; Hello guys. I'm having a difficult time trying to figure out how to display SRF02 ultrasonic sensor values in inches. ...

  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 01:53 AM.

  2. #2
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    949
    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, 09: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, 03:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21