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: EthernetInterface HttpServer mbed-rpc mbed-rtos mbed
Fork of 08-01-Uebung by
main.cpp
- Committer:
- stefan1691
- Date:
- 2015-03-21
- Revision:
- 12:9281320e8687
- Parent:
- 11:4f5efa32051c
- Child:
- 13:9ac1a340866e
File content as of revision 12:9281320e8687:
/** 8.1 Kombiniert das Übung 6.1 Licht bei Dämmerung einschalten
mit RPC Variable um die Sensordaten via Client abzufragen.
*/
#include "mbed.h"
#include "rtos.h"
#include "EthernetInterface.h"
#include "HTTPServer.h"
#include "mbed_rpc.h"
EthernetInterface eth;
// Servo + aktuelle Werte
AnalogIn light( A1 );
float val1;
Ticker sensors;
// Update Sensor Werte
void updateVal()
{
val1 = light;
}
int main()
{
printf("RPC HTTP Server\n");
eth.init(); //Use DHCP
eth.connect();
printf("IP Address is %s\n\r", eth.getIPAddress());
sensors.attach( &updateVal, 1.0 );
// Objekte
RPCVariable<float> rpcVal1( &val1, "light" );
// Handler
HTTPServerAddHandler<RPCHandler>("/rpc");
// Start HTTP Server auf Port 80
printf( "Starte Server\n" );
HTTPServerStart(80);
}
