/**************************************************************************************************
*
*  Supersonic SRF05
*
*   Version:      1.0.0 - January 2009
*   Author:       Etienne Ribeiro    / tutorial assistant caad      /  eribeiro[at]ethz.ch
*   Supervisor:   Christoph Wartmann / chair for caad - ETH Zürich  /  wartmann[at].arch.ethz.ch
*
*   Desc:         This Module can be used to plug severel Supersonic SRF05 Sensors to your
*                 project. Connect your sensors to any digital pin on your board.
*
***************************************************************************************************/




// Const

static int digitalPin1 = 0;
static int digitalPin2 = 24;



// Setup

void setup() {

        //LED (2 * blink)
        pinMode(48, OUTPUT);
        digitalWrite(48, HIGH);
        delay(200);
        digitalWrite(48, LOW);
        delay(200);
        digitalWrite(48, HIGH);


        // Initialize Serial
        Serial.begin(9600);
        Serial.println("Wiring Started");

}




// Loop

void loop() {

        // Mesure Distance:
        int ret1;
        int ret2;
        SRF05_getDistanceInCM (digitalPin1, &ret1, &ret2);
        //
        int ret3;
        int ret4;
        SRF05_getDistanceInCM (digitalPin2, &ret3, &ret4);


        // Print
        Serial.print(ret1);
        Serial.print(".");
        Serial.print(ret2);
        Serial.print("         --        ");
        Serial.print(ret3);
        Serial.print(".");
        Serial.println(ret4);


        // Wait
        delay(50);

}

This website has been archived and is no longer maintained.