Practical Robotics Modular Robot Library

Dependents:   ModularRobot

Revision:
0:8a2dd255c508
Child:
1:a6728adaf7e7
diff -r 000000000000 -r 8a2dd255c508 sensors.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sensors.h	Sat Nov 26 17:28:53 2016 +0000
@@ -0,0 +1,38 @@
+#ifndef SENSORS_H
+#define SENSORS_H
+
+class Sensors
+{
+public:
+
+
+    /**
+     *  Reads and stores a value from the ADS7830 i2c ADC used for the Sharp distance sensors
+     *
+     * @param channel - The channel to read from (0 to 7)
+     * @return The 8-bit value returned by the ADC
+     */
+    char read_adc_value(char channel);
+
+    /**
+     *  Returns the stored value from the last call of read_adc_value
+     *
+     * @param channel - The channel to read from (0 to 7)
+     * @return The stored 8-bit value 
+     */
+    char get_adc_value(char channel);
+
+   /**
+    *  Starts a ticker which reads and stores the value for each distance sensor at a 
+    * frequency defined by SENSOR_TICKER_PERIOD (eg 10Hz)
+    */
+   void start_sensor_ticker(void);
+
+   /**
+    * Reads the next sensor
+    */
+    void sensor_ticker_routine(void);
+};
+
+
+#endif