![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
asdf
Dependencies: Servo mbed mbedConnectorInterface mbedEndpointNetwork
Fork of TempAndDistTest by
main.cpp@4:20feba0e781b, 2015-05-09 (annotated)
- Committer:
- mnorris
- Date:
- Sat May 09 19:00:40 2015 +0000
- Revision:
- 4:20feba0e781b
- Parent:
- 3:c17adf68862b
Bug fixes, uses PUT
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Luminoscity | 0:cb422b231ea5 | 1 | #include "mbed.h" |
mnorris | 3:c17adf68862b | 2 | #include "EthernetInterface.h" |
mnorris | 3:c17adf68862b | 3 | #include "ConnectorEndpoint.h" |
mnorris | 3:c17adf68862b | 4 | #include "OptionsBuilder.h" |
mnorris | 3:c17adf68862b | 5 | |
mnorris | 3:c17adf68862b | 6 | #include "Servo.h" |
mnorris | 3:c17adf68862b | 7 | |
mnorris | 3:c17adf68862b | 8 | #include "StaticResource.h" |
mnorris | 3:c17adf68862b | 9 | #include "ServoResource.h" |
mnorris | 3:c17adf68862b | 10 | |
mnorris | 3:c17adf68862b | 11 | /* Terminal connection */ |
mnorris | 3:c17adf68862b | 12 | RawSerial term(USBTX, USBRX); |
mnorris | 3:c17adf68862b | 13 | Logger logger(&term); |
mnorris | 3:c17adf68862b | 14 | |
mnorris | 3:c17adf68862b | 15 | /* Sensors */ |
mnorris | 3:c17adf68862b | 16 | #define SERVO_PIN D4 |
mnorris | 3:c17adf68862b | 17 | Servo servoA(SERVO_PIN); |
Luminoscity | 0:cb422b231ea5 | 18 | |
mnorris | 3:c17adf68862b | 19 | /* Resources */ |
mnorris | 3:c17adf68862b | 20 | StaticResource mfg(&logger, "3/0/0", "Freescale"); |
mnorris | 3:c17adf68862b | 21 | StaticResource model(&logger, "3/0/1", "K64F mbed Ethernet demo"); |
mnorris | 3:c17adf68862b | 22 | |
mnorris | 3:c17adf68862b | 23 | StaticResource latitude(&logger, "6/0/0", "35.296"); |
mnorris | 3:c17adf68862b | 24 | StaticResource longitude(&logger, "6/0/1", "-120.677"); |
mnorris | 3:c17adf68862b | 25 | |
mnorris | 3:c17adf68862b | 26 | ServoResource servoR(&logger, "3302/0/5600", &servoA, true); |
Luminoscity | 0:cb422b231ea5 | 27 | |
mnorris | 3:c17adf68862b | 28 | /* invoked through linker magic via Endpoint::start() */ |
mnorris | 3:c17adf68862b | 29 | Connector::Options *configure_endpoint(Connector::OptionsBuilder &config) |
mnorris | 3:c17adf68862b | 30 | { |
mnorris | 3:c17adf68862b | 31 | /* NSP configuration is in nsp_configuration.h */ |
mnorris | 3:c17adf68862b | 32 | logger.log("configure_endpoint: building endpoint configuration..."); |
mnorris | 3:c17adf68862b | 33 | servoR.setMaxAge(15); |
mnorris | 3:c17adf68862b | 34 | return config.addResource(&mfg) |
mnorris | 3:c17adf68862b | 35 | .addResource(&model) |
mnorris | 3:c17adf68862b | 36 | .addResource(&latitude) |
mnorris | 3:c17adf68862b | 37 | .addResource(&longitude) |
mnorris | 3:c17adf68862b | 38 | .addResource(&servoR) |
mnorris | 3:c17adf68862b | 39 | .build(); |
mnorris | 3:c17adf68862b | 40 | } |
Luminoscity | 0:cb422b231ea5 | 41 | |
Luminoscity | 0:cb422b231ea5 | 42 | int main() { |
mnorris | 3:c17adf68862b | 43 | logger.log("\r\n\r\nServoTest booting\r\n"); |
mnorris | 3:c17adf68862b | 44 | Connector::Endpoint::plumbNetwork(); |
mnorris | 3:c17adf68862b | 45 | Connector::Endpoint::start(); |
mnorris | 3:c17adf68862b | 46 | } |