Code for the COVR project DROPSAW project test rig (previously used for the Heros testing).

Dependencies:   SPTE_10Bar_5V mbed AS5048 SDFileSystem MODSERIAL LCM101_DROPSAW LinearActuator

Committer:
cnckiwi31
Date:
Mon Oct 26 08:33:02 2020 +0000
Revision:
14:dd4193213be9
Parent:
11:fc82dd22a527
Prepared for documentation with addition of boilerplate

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cnckiwi31 14:dd4193213be9 1 /* Copyright 2020 Allan Joshua Veale
cnckiwi31 14:dd4193213be9 2
cnckiwi31 14:dd4193213be9 3 Licensed under the Apache License, Version 2.0 (the "License");
cnckiwi31 14:dd4193213be9 4 you may not use this file except in compliance with the License.
cnckiwi31 14:dd4193213be9 5 You may obtain a copy of the License at
cnckiwi31 14:dd4193213be9 6
cnckiwi31 14:dd4193213be9 7 http://www.apache.org/licenses/LICENSE-2.0
cnckiwi31 14:dd4193213be9 8
cnckiwi31 14:dd4193213be9 9 Unless required by applicable law or agreed to in writing, software
cnckiwi31 14:dd4193213be9 10 distributed under the License is distributed on an "AS IS" BASIS,
cnckiwi31 14:dd4193213be9 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
cnckiwi31 14:dd4193213be9 12 See the License for the specific language governing permissions and
cnckiwi31 14:dd4193213be9 13 limitations under the License.
cnckiwi31 14:dd4193213be9 14 */
cnckiwi31 14:dd4193213be9 15
surajgiri 11:fc82dd22a527 16 #ifndef _VALVEDIGITAL_H_
surajgiri 11:fc82dd22a527 17 #define _VALVEDIGITAL_H_
surajgiri 11:fc82dd22a527 18
surajgiri 11:fc82dd22a527 19 #include "mbed.h"
surajgiri 11:fc82dd22a527 20 /**
surajgiri 11:fc82dd22a527 21 * Controlling an on/off valve
surajgiri 11:fc82dd22a527 22 */
surajgiri 11:fc82dd22a527 23
surajgiri 11:fc82dd22a527 24 class ValveDigital
surajgiri 11:fc82dd22a527 25 {
surajgiri 11:fc82dd22a527 26 public:
surajgiri 11:fc82dd22a527 27
surajgiri 11:fc82dd22a527 28 /**
cnckiwi31 14:dd4193213be9 29 * @param pin_d_out: PinName of digital output
surajgiri 11:fc82dd22a527 30 */
surajgiri 11:fc82dd22a527 31 ValveDigital (PinName pin_d_out) :
surajgiri 11:fc82dd22a527 32 digital_out_(pin_d_out)
surajgiri 11:fc82dd22a527 33 {
surajgiri 11:fc82dd22a527 34 }
surajgiri 11:fc82dd22a527 35
surajgiri 11:fc82dd22a527 36 /**
surajgiri 11:fc82dd22a527 37 * @return valve state
surajgiri 11:fc82dd22a527 38 */
surajgiri 11:fc82dd22a527 39 float getValve()
surajgiri 11:fc82dd22a527 40 {
surajgiri 11:fc82dd22a527 41 return digital_out_.read();
surajgiri 11:fc82dd22a527 42 }
surajgiri 11:fc82dd22a527 43
surajgiri 11:fc82dd22a527 44 /**
cnckiwi31 14:dd4193213be9 45 * @param set: turn the valve on (true) or off (false)
surajgiri 11:fc82dd22a527 46 */
surajgiri 11:fc82dd22a527 47 void setValve(bool set)
surajgiri 11:fc82dd22a527 48 {
surajgiri 11:fc82dd22a527 49 digital_out_.write((int)set);
surajgiri 11:fc82dd22a527 50 return;
surajgiri 11:fc82dd22a527 51 }
surajgiri 11:fc82dd22a527 52
surajgiri 11:fc82dd22a527 53
surajgiri 11:fc82dd22a527 54 private:
surajgiri 11:fc82dd22a527 55 DigitalOut digital_out_;
surajgiri 11:fc82dd22a527 56 };
surajgiri 11:fc82dd22a527 57
surajgiri 11:fc82dd22a527 58 #endif