confidential

Dependencies:   Chainable_RGB_LED mbed mbedConnectorInterface mbedEndpointNetwork

Committer:
dscrobonia
Date:
Sat May 09 21:00:59 2015 +0000
Revision:
2:0382d0c13a51
Parent:
0:02b8d440ded3
results csv info;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cjwu15 0:02b8d440ded3 1 /**
cjwu15 0:02b8d440ded3 2 * @file SliderResource.h
cjwu15 0:02b8d440ded3 3 * @brief mbed CoAP Endpoint
cjwu15 0:02b8d440ded3 4 * @author Michael Koster
cjwu15 0:02b8d440ded3 5 * @version 1.0
cjwu15 0:02b8d440ded3 6 * @see
cjwu15 0:02b8d440ded3 7 *
cjwu15 0:02b8d440ded3 8 * Copyright (c) 2015
cjwu15 0:02b8d440ded3 9 *
cjwu15 0:02b8d440ded3 10 * Licensed under the Apache License, Version 2.0 (the "License");
cjwu15 0:02b8d440ded3 11 * you may not use this file except in compliance with the License.
cjwu15 0:02b8d440ded3 12 * You may obtain a copy of the License at
cjwu15 0:02b8d440ded3 13 *
cjwu15 0:02b8d440ded3 14 * http://www.apache.org/licenses/LICENSE-2.0
cjwu15 0:02b8d440ded3 15 *
cjwu15 0:02b8d440ded3 16 * Unless required by applicable law or agreed to in writing, software
cjwu15 0:02b8d440ded3 17 * distributed under the License is distributed on an "AS IS" BASIS,
cjwu15 0:02b8d440ded3 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
cjwu15 0:02b8d440ded3 19 * See the License for the specific language governing permissions and
cjwu15 0:02b8d440ded3 20 * limitations under the License.
cjwu15 0:02b8d440ded3 21 */
cjwu15 0:02b8d440ded3 22
cjwu15 0:02b8d440ded3 23 #ifndef __SLIDER_RESOURCE_H__
cjwu15 0:02b8d440ded3 24 #define __SLIDER_RESOURCE_H__
cjwu15 0:02b8d440ded3 25
cjwu15 0:02b8d440ded3 26 // Base class
cjwu15 0:02b8d440ded3 27 #include "DynamicResource.h"
cjwu15 0:02b8d440ded3 28
cjwu15 0:02b8d440ded3 29 // Slide Potentiometer connected to A0
cjwu15 0:02b8d440ded3 30 AnalogIn slider_in(A0);
cjwu15 0:02b8d440ded3 31
cjwu15 0:02b8d440ded3 32 /** TemperatureResource class
cjwu15 0:02b8d440ded3 33 */
cjwu15 0:02b8d440ded3 34 class SliderResource : public DynamicResource
cjwu15 0:02b8d440ded3 35 {
cjwu15 0:02b8d440ded3 36 public:
cjwu15 0:02b8d440ded3 37 /**
cjwu15 0:02b8d440ded3 38 Default constructor
cjwu15 0:02b8d440ded3 39 @param logger input logger instance for this resource
cjwu15 0:02b8d440ded3 40 @param name input the resource name
cjwu15 0:02b8d440ded3 41 @param observable input the resource is Observable (default: FALSE)
cjwu15 0:02b8d440ded3 42 */
cjwu15 0:02b8d440ded3 43 SliderResource(const Logger *logger,const char *name,const bool observable = false) : DynamicResource(logger,name,"Slider", SN_GRS_GET_ALLOWED,observable) {
cjwu15 0:02b8d440ded3 44 }
cjwu15 0:02b8d440ded3 45
cjwu15 0:02b8d440ded3 46 /**
cjwu15 0:02b8d440ded3 47 Get the value of the slide potentiometer
cjwu15 0:02b8d440ded3 48 @returns string containing the slider value from 0-1.00
cjwu15 0:02b8d440ded3 49 */
cjwu15 0:02b8d440ded3 50 virtual string get() {
cjwu15 0:02b8d440ded3 51 char slider_pos[7];
cjwu15 0:02b8d440ded3 52 memset(slider_pos,0,7);
cjwu15 0:02b8d440ded3 53 sprintf(slider_pos,"%3.2f", slider_in.read());
cjwu15 0:02b8d440ded3 54 return string(slider_pos);
cjwu15 0:02b8d440ded3 55 }
cjwu15 0:02b8d440ded3 56 };
cjwu15 0:02b8d440ded3 57
cjwu15 0:02b8d440ded3 58 #endif // __SLIDER_RESOURCE_H__