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.
Dependencies: mbed
Fork of Solar by
Revision 0:40a765d1b46b, committed 2016-02-17
- Comitter:
- gert_lauritsen
- Date:
- Wed Feb 17 22:09:53 2016 +0000
- Child:
- 1:87df5ce85ede
- Commit message:
- ; This demo will read the Voltage and Current from the "AttoPilot Voltage and Current Sense Board,"; convert the raw ADC data to Volts and Amps and display them as floating point numbers on the; Serial Enabled LCD. (If you would like to do without the S
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Feb 17 22:09:53 2016 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+
+RawSerial pc(USBTX, USBRX);
+AnalogIn Ain1(p19);// --- AttoPilot "V"
+AnalogIn Ain2(p20);// --- AttoPilot "I"
+
+int VRaw; //This will store our raw ADC data
+int IRaw;
+float VFinal; //This will store the converted data
+float IFinal;
+
+int main()
+{
+ while(1) {
+ VRaw = Ain1.read_u16();
+ IRaw = Ain2.read_u16();
+
+ //Conversion
+ VFinal = VRaw/49.44; //45 Amp board
+ //VFinal = VRaw/12.99; //90 Amp board
+ //VFinal = VRaw/12.99; //180 Amp board
+
+ IFinal = IRaw/14.9; //45 Amp board
+ //IFinal = IRaw/7.4; //90 Amp board
+ //IFinal = IRaw/3.7; //180 Amp board
+ pc.printf("%.1 Volts\r\n",VFinal);
+ pc.printf("%.1f Amps\r\n\r\n\r\n",IFinal);
+ wait(0.2);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Feb 17 22:09:53 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/252557024ec3 \ No newline at end of file
