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: RPCInterface mbed
Fork of RPC_RangeFinderDemo by
main.cpp
00001 /** 00002 * Copyright (c)2010 ARM Ltd. 00003 * Released under the MIT License: http://mbed.org/license/mit 00004 */ 00005 #include "mbed.h" 00006 #include "SerialRPCInterface.h" 00007 00008 00009 using namespace mbed; 00010 00011 //Create the interface on the USB Serial Port 00012 SerialRPCInterface RPC(USBTX, USBRX, 9600); // it defaults to 9600 if you don't put the baud Paramete in but I've put it in so can be changed 00013 void SetTime(char * input, char * output); 00014 RPCFunction TimeSet(&SetTime, "TimeSet"); 00015 DigitalOut myled(LED1); 00016 00017 int main() { 00018 00019 while(1) { 00020 myled = 1; 00021 wait(0.2); 00022 myled = 0; 00023 wait(0.2); 00024 } 00025 } 00026 00027 // REM to call this function via RPC TimeSet 00028 void SetTime(char * input, char * output){ 00029 time_t time_value = time_t(input); 00030 set_time(time_value); 00031 time_t seconds = time(NULL); 00032 sprintf(output, "\r\n Time as seconds since January 1, 1970 = %d\r\n", seconds); // puts String into "output" for SerialRPC to process and transmit 00033 } 00034 00035 // so set up terminal up to 9600 baud and type "/TimeSet/run 232323" 00036
Generated on Thu Aug 18 2022 21:24:17 by
1.7.2
