Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: AnalogIO_1ch/AdcInternal.hpp
- Revision:
- 0:f69d3c64978d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/AnalogIO_1ch/AdcInternal.hpp Mon Jul 28 07:30:22 2014 +0000
@@ -0,0 +1,27 @@
+//------------------------------------------------------
+// Class for internal ADC for signal processing
+//
+// Copyright (c) 2014 MIKAMI, Naoki, 2014/06/17
+//------------------------------------------------------
+
+#ifndef ADC_INTERNAL_HPP
+#define ADC_INTERNAL_HPP
+
+#include "mbed.h"
+
+namespace Mikami
+{
+ class Adc
+ {
+ public:
+ explicit Adc(PinName pin = A0)
+ : adc_(pin) {}
+ float Read()
+ { return 2*(adc_.read() - 0.5f); }
+ private:
+ Adc(const Adc&);
+ Adc& operator=(const Adc&);
+ AnalogIn adc_;
+ };
+}
+#endif // ADC_INTERNAL_HPP