Amb Light test - NOT WORKING / TESTED

Files at this revision

API Documentation at this revision

Comitter:
monpjc
Date:
Fri May 17 20:13:13 2013 +0000
Commit message:
NEW

Changed in this revision

WiGo_AmbLight.cpp Show annotated file Show diff for this revision Revisions of this file
WiGo_AmbLight.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r be6163c66a11 WiGo_AmbLight.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WiGo_AmbLight.cpp	Fri May 17 20:13:13 2013 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+#include "WiGo_AmbLight.h"
+
+WiGo_AmbLight::WiGo_AmbLight( PinName en, PinName level) : _en(en), _level(level)
+{
+    _en = 0; //Default off
+}
+
+void WiGo_AmbLight::en( int n)
+{
+    if( n == 0 )
+        _en = 0;
+    else
+        _en = 1;
+}
+  
+int WiGo_AmbLight::level( void )
+{
+    return (int) _level.read();
+}
+
diff -r 000000000000 -r be6163c66a11 WiGo_AmbLight.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WiGo_AmbLight.h	Fri May 17 20:13:13 2013 +0000
@@ -0,0 +1,27 @@
+#ifndef _WIGO_AMBLIGHT_H_
+#define _WIGO_AMBLIGHT_H_
+
+#include "mbed.h"
+
+//Circuit for Avnet WiGo board
+#define AMBLIGHT_EN     PTD5
+#define AMBLIGHT_LVL    PTB0
+#define AMBLIGHT_HIGH   1
+#define AMBLIGHT_LOW    0
+
+class WiGo_AmbLight
+{
+public:
+
+    WiGo_AmbLight( PinName en, PinName level );
+
+    void en( int n);
+  
+    int level( void );
+    
+protected:
+    DigitalOut _en;
+    AnalogIn  _level;
+};
+
+#endif