Overview | Main | State Machine | Events | IR | Tape | Drivetrain | PWM | Flash | Two Minute Timer | Bump

bumpSensor.c
bumpSensor.h

void initBump(void): initialize the bump sensors

char getBump(char sensor): query a given bump sensor for its current state

void main(void): test harness for the bump module

The bump module provides a simple interface to the bump sensors.

PSEUDOCODE

(Download Pseudocode .doc 26kb)

void initBump(void)
    Set the data direction of the bump sensor pins to be inputs

char getBump(char sensor)
    If sensor is front
        If the front pin is high
            Return off
        If the front pin is low
            Return on
    If the sensor is back
        If the back pin is high
            Return off
        If the back pin is low
            Return on

void main(void) **Test Harness**
    Initialize the bump module
    Repeat forever
        If the front bump sensor is on
            Report it
        If the back bump sensor is on
            Report it