VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
All Classes Namespaces Files Functions Variables Enumerations
vex_bumper.h
Go to the documentation of this file.
1/*----------------------------------------------------------------------------*/
2/* */
3/* Copyright (c) Innovation First 2017, All rights reserved. */
4/* */
5/* Module: vex_bumper.h */
6/* Author: James Pearman */
7/* Created: 7 July 2017 */
8/* */
9/* Revisions: */
10/* V1.00 TBD - Initial release */
11/* */
12/*----------------------------------------------------------------------------*/
13
14#ifndef VEX_BUMPER_CLASS_H
15#define VEX_BUMPER_CLASS_H
16
17/*-----------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22/*-----------------------------------------------------------------------------*/
24/*-----------------------------------------------------------------------------*/
25namespace vex {
26 class bumper : public device {
27
28 public:
33 bumper( int32_t index );
34 ~bumper();
35
36 bool installed();
37
42 int32_t value();
43
48 int32_t pressing() { return value(); };
49
54 void pressed( void (* callback)(void) );
55
60 void released( void (* callback)(void) );
61
62 private:
63 enum class tEventType {
64 EVENT_PRESSED = 1,
65 EVENT_RELEASED = 2
66 };
67
68 uint8_t _eventId_1;
69 uint8_t _eventId_2;
70 };
71};
72
73#endif // VEX_BUMPER_CLASS_H
void released(void(*callback)(void))
Calls a function when the bumper switch is released.
bumper(int32_t index)
Creates a new bumper object on the port specified in the parameter.
int32_t value()
Gets the value of the bumper device.
void pressed(void(*callback)(void))
Calls a function when the bumper switch is pressed.
int32_t pressing()
Get the pressed status of the bumper device.
Definition vex_bumper.h:48
Bumper switch device class
Definition vex_brain.h:24