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: Servo mbed mbedConnectorInterface mbedEndpointNetwork
Fork of TempAndDistTest by
Revision 4:20feba0e781b, committed 2015-05-09
- Comitter:
- mnorris
- Date:
- Sat May 09 19:00:40 2015 +0000
- Parent:
- 3:c17adf68862b
- Commit message:
- Bug fixes, uses PUT
Changed in this revision
diff -r c17adf68862b -r 20feba0e781b nsp_configuration.h --- a/nsp_configuration.h Sat May 09 18:40:08 2015 +0000 +++ b/nsp_configuration.h Sat May 09 19:00:40 2015 +0000 @@ -25,7 +25,7 @@ // NSP node name #define NODE_NAME_LENGTH 24 - #define NODE_NAME "trashcan" + #define NODE_NAME "servotest" // NSP Address (4 bytes for IPV4, 16 bytes for IPV6) #define NSP_IP_ADDRESS_LENGTH 4 @@ -37,6 +37,6 @@ // NSP Domain used #define NSP_DOMAIN_LENGTH 24 - #define NSP_DOMAIN "trash" + #define NSP_DOMAIN "servo" #endif // __NSP_CONFIGURATION_H__ \ No newline at end of file
diff -r c17adf68862b -r 20feba0e781b resource/ServoResource.cpp
--- a/resource/ServoResource.cpp Sat May 09 18:40:08 2015 +0000
+++ b/resource/ServoResource.cpp Sat May 09 19:00:40 2015 +0000
@@ -20,4 +20,13 @@
string ServoResource::get() {
return "";
-}
\ No newline at end of file
+}
+
+void ServoResource::put(const string input) {
+ if (input == "on") {
+ on();
+ }
+ else {
+ off();
+ }
+}
diff -r c17adf68862b -r 20feba0e781b resource/ServoResource.h
--- a/resource/ServoResource.h Sat May 09 18:40:08 2015 +0000
+++ b/resource/ServoResource.h Sat May 09 19:00:40 2015 +0000
@@ -7,12 +7,13 @@
class ServoResource : public DynamicResource {
public:
ServoResource(const Logger *logger, const char *name, Servo *servo, const bool observable = false)
- : DynamicResource(logger, name, "ServoResource", SN_GRS_GET_ALLOWED, observable), servo(servo)
+ : DynamicResource(logger, name, "ServoResource", SN_GRS_PUT_ALLOWED, observable), servo(servo)
{}
void on();
void off();
+ virtual void put(const string);
virtual string get();
private:
