Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 11 months ago.
Solve this error? (Compiler Error L6218E)
Having trouble compilling the following code: ```
- include "mbed.h"
- include "m3pi.h"
- include "wattmeter.h"
wattmeter::wattmeter() { m3pi pi; Photo diode to see when to start meter AnalogOut photdio(p18); Timer for charging time Timer timer; Variable containing with all collected data float Ws; Collects temporary data and adds to "Ws" float Ws_0; Placeholder for pi.battery function (Gets float value for voltage) float bat = pi.battery(); while(photdio == 1) { timer.reset(); timer.start(); Clear LCD pi.cls(); Locate the cursor on the display pi.locate(0,0); pi.printf("Charging: Watt second"); if(timer.read()==1) { Watt calculation - "0.16" = Current (160 mA) - "1" = 1 second Ws_0 = bat*0.16*1; Ws+=Ws_0; Clear LCD pi.cls(); Locate the cursor on the display pi.locate(0,0); Print the total Watt second to LCD pi.printf("%.2f Ws",Ws); } } } ```
I have made a class header for the "wattmeter":
The error that shows up is the following: