I'm a novice C++ user, but I'm having fun with the mbed.
I want the mbed to read a temperature, and make that temperature available for PC query using Javascript.
I have had good results with the examples of remotely turning on/off LEDs using RPC. I have also interfaced a temperature sensor (using the TMP102 library) and can display the value locally on a LCD.
But when I try to use RPCVariable to allow the temperature to be queried over HTTP, I get compiler error 70 (Incomplete type is not allowed) at line 80 of the RPCVariable library.
I'm stuck. Any suggestions would be welcome!
Listing below:
__________________
- include "mbed.h"
- include "EthernetNetIf.h"
- include "HTTPServer.h"
- include "RPCVariable.h"
- include "TMP102.h"
- include "TextLCD.h"
float TempC;
LocalFileSystem fs("webfs");
TextLCD lcd(p11, p25, p12, p15, p16, p29, p30); rs, rw, e, d0, d1, d2, d3 ;
EthernetNetIf eth;
TMP102 temperature(p9, p10, 0x90); A0 pin is connected to ground
HTTPServer svr;
Make this variable accessible over RPC by attaching them to an RPCVariable;
RPCVariable<float> RPCTempC(&TempC, "TempC");
int main()
{
lcd.printf("Setting up...\n");
EthernetErr ethErr = eth.setup();
if(ethErr)
{
lcd.printf("Error %d in setup.\n", ethErr);
return -1;
}
lcd.printf("Setup OK\n");
FSHandler::mount("/webfs", "/files"); Mount /webfs path on /files web path
FSHandler::mount("/webfs", "/"); Mount /webfs path on web root path
svr.addHandler<SimpleHandler>("/hello");
svr.addHandler<RPCHandler>("/rpc");
svr.addHandler<FSHandler>("/files");
svr.addHandler<FSHandler>("/"); Default handler
svr.bind(80);
lcd.printf("Listening...\n");
Listen indefinitely
while (true) {
TempC = temperature.read();
lcd.printf("Temp: %f\n", TempC);
wait(.5);
}
return 0;
}
I'm a novice C++ user, but I'm having fun with the mbed.
I want the mbed to read a temperature, and make that temperature available for PC query using Javascript.
I have had good results with the examples of remotely turning on/off LEDs using RPC. I have also interfaced a temperature sensor (using the TMP102 library) and can display the value locally on a LCD.
But when I try to use RPCVariable to allow the temperature to be queried over HTTP, I get compiler error 70 (Incomplete type is not allowed) at line 80 of the RPCVariable library.
I'm stuck. Any suggestions would be welcome!
Listing below: __________________
float TempC;
LocalFileSystem fs("webfs");
TextLCD lcd(p11, p25, p12, p15, p16, p29, p30); rs, rw, e, d0, d1, d2, d3 ;
EthernetNetIf eth;
TMP102 temperature(p9, p10, 0x90); A0 pin is connected to ground
HTTPServer svr;
Make this variable accessible over RPC by attaching them to an RPCVariable;
RPCVariable<float> RPCTempC(&TempC, "TempC");
int main() { lcd.printf("Setting up...\n");
EthernetErr ethErr = eth.setup();
if(ethErr) { lcd.printf("Error %d in setup.\n", ethErr); return -1; } lcd.printf("Setup OK\n");
FSHandler::mount("/webfs", "/files"); Mount /webfs path on /files web path
FSHandler::mount("/webfs", "/"); Mount /webfs path on web root path
svr.addHandler<SimpleHandler>("/hello");
svr.addHandler<RPCHandler>("/rpc");
svr.addHandler<FSHandler>("/files");
svr.addHandler<FSHandler>("/"); Default handler svr.bind(80);
lcd.printf("Listening...\n");
Listen indefinitely
while (true) { TempC = temperature.read();
lcd.printf("Temp: %f\n", TempC);
wait(.5); }
return 0; }