RCKit
RCRx.h
1 // RCRx.h
2 //
3 // Remote Control Receiver module for RCOIP protocol
4 // Copyright (C) 2010-2012 Mike McCauley
5 // $Id: RCRx.h,v 1.7 2018/09/17 23:09:57 mikem Exp mikem $
6 
7 /// \mainpage RCKit library for Arduino
8 ///
9 /// This is the Arduino RCKit library.
10 ///
11 /// RCKit provides a kit of software objects that make it easy to build an
12 /// RCOIP (Remote Control Over IP) receiver on Arduino. RCOIP protocol is used to
13 /// carry remote control commands from a transmitter to a receiver over an IP
14 /// transport such as Ethernet or Wi-Fi.
15 ///
16 /// As such it can be used to build Remote Controlled (RC) vehicles and devices of various kinds, along with
17 /// matching transmitters. Large numbers of channels can be supported, along with a back-channel
18 /// which sends data from the Receiver to the Transmitter.
19 /// A compatible iPhone transmitter app is also available.
20 ///
21 /// The transmitter could be a handheld Wi-Fi enabled device such as an iPhone, iPad or Arduino based device.
22 /// Or it could be an interactive program running on a desktop computer. The RCTx iPhone transmitter app is
23 /// available on the Apple App Store. It provides a simple RCOIP transmitter equipped with 2 joysticks and
24 /// a number of switches.
25 ///
26 /// The receiver (using this RCKit software) could be a remote controlled car,
27 /// plane, helicopter or some other device.
28 ///
29 /// The RCOIP protocol is a 2-way protocol that defines UDP messages between
30 /// the RCOIP transmitter and receiver.
31 /// This effectively makes the transmitter a UDP client and the receiver a UDP server.
32 /// Messages sent from the transmitter to the receiver include setting analog outputs,
33 /// and messages from the receiver to the transmitter include receiver status messages.
34 ///
35 /// RCTx, RCKit and the RCOIP protocol offer the following advantages over conventional Remote Control:
36 /// \li Large numbers of channels (> 100) not just 5 or 6, including analog, digital, text, data etc.
37 /// \li Back channel for telemetry (voltages, signal strengths, GPS position etc)
38 /// \li Failsafe modes
39 /// \li Programmable, configurable and extensible
40 /// \li Works with a variety of types of vehicle and remote devices
41 /// \li Hackable
42 /// \li Opportunity to tightly integrate remote control and autonomous vehicle software control
43 /// \li Works with a variety of IP transports Wi-Fi (ad-hoc or infrastructure), Wired etc.
44 ///
45 /// Videos explaining how it works and what you can do with it can be found at:
46 /// \li https://youtu.be/R5kAfpTJYwM
47 /// \li https://youtu.be/sw0nUlkJ-DM
48 ///
49 /// There is also a video showing how RCKit can be used with the IRrc library at
50 /// http://www.airspayce.com/mikem/arduino/IRrc to control a 3 channel infra-red model helicopter at:
51 /// \li https://youtu.be/srs1Jn5EVhQ
52 ///
53 /// The version of the package that this documentation refers to can be downloaded
54 /// from http://www.airspayce.com/mikem/arduino/RCKit/RCKit-2.7.zip
55 /// You can find the latest version at http://www.airspayce.com/mikem/arduino/RCKit
56 ///
57 /// You can also find online help and disussion at http://groups.google.com/group/rckit
58 /// Please use that group for all questiongs and discussions on this topic.
59 /// Do not contact the author directly, unless it is to discuss commercial licensing.
60 ///
61 /// Tested on Arduino Duemilanove, Diecimila, Mega and Asynclabs Yellowjacket
62 /// with arduino-1.0 and arduino 1.0.1 on OpenSuSE 12/
63 /// and avr-libc-1.6.2-5.11,
64 /// cross-avr-binutils-2.19-9.1 and cross-avr-gcc43-4.3.3_20081022-9.3
65 /// Also Arduino 1.8.1 and ESP8266 with built-in WiFi
66 ///
67 /// \par RCRx
68 ///
69 /// RCRx class is an RCOIP receiver. It works with Arduino and a range of communications hardware like
70 /// ESP8266 WiFi transceivers and Ethernet to receive commands from an
71 /// RCOIP compliant Transmitter (such as the RCTx iPhone app available on the Apple App Store).
72 ///
73 /// When the RCRx object is constructed, it must be given an array of Setter objects.
74 /// When a RCOIPv1CmdSetAnalogChannels message is received by RCRx, The Setter corresponding to each
75 /// Channel value in the RCOIPv1CmdSetAnalogChannels command will be passed to the
76 /// respective Setter in the analogOutputs array.
77 /// The Arduino software is expected to be configured so that each analogOutput is connected to a Setter that
78 /// will implement the received value, perhaps by setting an analog or digital output on an Arduino pin.
79 /// Setter objects are provided to achieve this. See below.
80 ///
81 /// RCRx will automatically respond to received commands with RCOIPv1ReplyReceiverStatus messages
82 /// as appropriate to the configured timeouts etc. See the RCOIP protocol document for more details.
83 ///
84 /// \par Setters
85 ///
86 /// Setter classes are objects that receive a value, maybe transform it and then do something with it. Typically
87 /// they set an output pin according to the received input value, but almost any other transformation,
88 /// output or communication can be imagined.
89 ///
90 /// The following output Setter objects are provided with RCKit. They can be used to translate
91 /// receiver channel values into physical outputs:
92 /// \li AnalogSetter
93 /// \li DigitalSetter
94 /// \li ServoSetter
95 /// \li AccelStepperPositionSetter
96 /// \li AccelStepperSpeedSetter
97 /// \li HBridgeSetter
98 /// \li DifferentialSetter
99 ///
100 /// The following transformation Setter objects are provided with RCKit. They can be used to
101 /// transform receiver channel values before being given to one of the output Setter classes above:
102 /// \li Inverter
103 /// \li Limiter
104 /// \li Linear
105 ///
106 /// \par Example Sketches
107 ///
108 /// Several example Arduino sketches are included, including a regression
109 /// test suite and a sample complete 5 channel receiver with Servo outputs for WiFi and Ethernet.
110 ///
111 /// \par Transceivers
112 ///
113 /// Version 2.0 of this library added the concept of a Transceiver, in order to be able to support
114 /// multiple type of communications transport.
115 /// A Transceiver is an object responsible for communicating with an RCOIP transmitter. Several types of
116 /// Transceiver are supported by the standard RCRx library:
117 /// - The builtin WiFi transceiver on an ESP8266
118 /// - Ethernet shield, or EtherTen, using the standard Arduino Ethernet library.
119 /// - WiShield WiFi shield or Yellowjacket or WiFi Bee, using the WiShield library (obsolete)
120 ///
121 /// You can define your own subclass of the Transceiver class to implement your own transports
122 /// (if you do so, consider contributing it back to the RCRx project).
123 /// The main RCRx reciver object must be told where its Transceiver object is, using setTransceiver().
124 /// Thereafter it will use that
125 /// Transceiver to receive RCOIP requests and to send replies back to the transmitter.
126 ///
127 /// \par RCTx iPhone App
128 ///
129 /// RCTx is an RCOIP compliant transmitter for iPhone available on the Apple App Store
130 /// at https://itunes.apple.com/us/app/rctx/id567423127?mt=8
131 ///
132 /// You can use it with a ESP8266Transceiver object to use the built-in WiFi transceiver on
133 /// an ESP8266 device, using the RXTx iPhone app:
134 ///
135 /// RCTx presents a simulated RC transmitter with 2 joysticks and a number of switches.
136 /// The left josystick sets channels 0 and 1 and the right joystick channels 2 and 3.
137 /// The switches set channels 4 through 9 inclusive. The joysticks can be configured for
138 /// manual or accelerometer and the switches can be configured for spring loaded or toggle operation.
139 /// The app reports the battery voltage and RSSI as measured by the ESP8266.
140 ///
141 /// To install and configure RCTx iPhone app to work with RCRx on a ESP8266 with WiFi
142 /// \li purchase and install the RCTx app on your iPhone.
143 /// \li Build and upload your RCRx+ESP8266Transceiver program to your ESP8266 hardware in the usual way.
144 /// See the examples/RCRxESP8266 for a starting point.
145 /// \li Power up the ESP8266
146 /// \li Turn on your iphone, go to Settings, Wi-Fi. Enable Wi-Fi
147 /// \li After about 30 seconds, you should see the RCArduino network appear as an available
148 /// network on the iPhone. Tap on it. Enter the password (default is "xyzzyxyzzy")
149 /// \li After about 10 seconds, the iPhone should be successfully connected to the RCArduino network,
150 /// which is the Access Point running on the ESP8266.
151 /// You now have an ad-hoc connection to the ESP8266. The ESP8266 will have the address 192.196.4.1
152 /// and the iPhone will have an address in 192.196.4.0/24
153 /// \li Start the RCTx app on the iPhone.
154 /// \li Tap on the little 'i' icon on the bottom right, get the profiles page.
155 /// Edit the default profile or create a new profile and set the RCOIP Reciver address to the IP address of the
156 /// ESP8266 (default 192.196.4.1).
157 /// Tap on Profile top left to the list of profiles, then tap on the profile you want to use.
158 /// \li After about 5 seconds, you should see the NO CONNECT in the bottom left corner change to
159 /// show RSSI and the correct battery voltage (if the ESP8266 is so equipped).
160 /// The reported RSSI is in dBm above -60 dBm.
161 /// \li Move the josticks and buttons. This will send RCOIP commands to the ESP8266.
162 /// RCRx in the arduino will convert them to analog output signals to drive your hardware. Have fun.
163 ///
164 /// To install and configure RCTx to work with an Ethernet equipped RCRx:
165 /// \li install the RCTx app on your iPhone.
166 /// \li Edit the sketch to set the desired IP address and MAC address for the Arduino
167 /// \li Build and upload your RCRx+EthernetTransceiver program you your Arduino+Ethernet hardware.
168 /// \li Power up the Arduino, connect it to your LAN.
169 /// \li Turn on your iphone, go to Settings, Wi-Fi. Enable Wi-Fi and connect to your LANs
170 /// wireless access point in the usual way.
171 /// \li Start the RCTx app on the iPhone.
172 /// \li Tap on the little 'i' icon on the bottom right, get the profiles page.
173 /// Edit the default profile or create a new profile and enter the IP address of the Arduino that you configured above.
174 /// \li After about 5 seconds, you should see the NO CONNECT in the bottom left corner change to
175 /// show RSSI of 0 and the correct battery voltage (if the Arduino is so equipped).
176 /// \li Move the josticks and buttons. This will send RCOIP commands to the Arduino.
177 /// RCRx in the arduino will convert them to analog output signals to drive your hardware. Have fun.
178 ///
179 /// To install and configure RCTx to work with a WiShield equipped RCRx:
180 /// Caution: OBSOLETE:
181 /// \li install the RCTx app on your iPhone.
182 /// \li Build and upload your RCRx+WiShieldTransceiver program you your Arduino+WiShield hardware
183 /// \li Power up the Arduino
184 /// \li Turn on your iphone, go to Settings, Wi-Fi. Enable Wi-Fi
185 /// \li After about 30 seconds, you should see the RCArduino network appear as an available
186 /// network on the iPhone. Tap on it.
187 /// Now tap on the RCArduino network details arrow to the right of the RCArduino line. Select 'Static'.
188 /// Enter an IP Address of 169.254.1.1. Enter a Subnet Mask of 255.255.0.0
189 /// \li After about 10 seconds, the iPhone should be successfully connected to the RCArduino network.
190 /// You now have an ad-hoc connection to the Arduino. The Arduino will have the address 169.254.1.100
191 /// and the iPhone will have address 169.254.1.1
192 /// \li Start the RCTx app on the iPhone.
193 /// \li After about 5 seconds, you should see the NO CONNECT in the bottom left corner change to
194 /// show RSSI and the correct battery voltage (if the Arduino is so equipped).
195 /// \li Move the josticks and buttons. This will send RCOIP commands to the Arduino.
196 /// RCRx in the arduino will convert them to analog output signals to drive your hardware. Have fun.
197 ///
198 ///
199 /// \par Prerequisites
200 ///
201 /// \li Arduino IDE 1.0 or later (earlier version do not support the EthernetUdp class required)
202 /// \li AccelStepper (http://www.airspayce.com/mikem/arduino/AccelStepper)
203 ///
204 /// If you intend to use the obsolete WiSHield support you must also install
205 /// \li WiShield (http://asynclabs.com) edited and configured to suit (see below for help)
206 /// and enable the RCRX_REQUIRE_WISHIELD macro below
207 ///
208 /// These prerequisites must be installed in the libraries directory of your Arduino devlopment environment,
209 /// even if you are not going to use them with RCRx, otherwise the RCRx will not build.
210 ///
211 /// \par Installation
212 ///
213 /// Install in the usual way: unzip the distribution zip file to the libraries
214 /// sub-folder of your Arduino IDE sketchbook.
215 ///
216 /// \par WiShield Library Configuration
217 ///
218 /// Caution: The WiShield Library support is obsolete and WiShield compatible devices are now almost impossible
219 /// to obtain. The WiShield support in RCRx is no disabled by default but can be enable by enabling
220 /// the RCRX_REQUIRE_WISHIELD macro below.
221 /// The recommended replacement is ESP8266 compatible devices with built-in WiFi support.
222 ///
223 /// Requires the Asynclabs WiShield library to be installed, even if you are not using
224 /// the WiShieldTransceiver. See http://asynclabs.com/wiki/index.php?title=WiShield_library
225 /// Install the WiShield library in the libraries directory of your arduino IDE installation,
226 /// then follow the configuration steps below:
227 ///
228 /// Support of RSSI (receiver signal strength indicator) requires mods to WiShield library g2100.c as per
229 /// http://asynclabs.com/forums/viewtopic.php?f=10&t=385&start=0. You dont have to add this but its a
230 /// good feature. It is included in the prebuilt WiShield library mentioned below.
231 ///
232 /// Correct operation of the WiShield requires you to set the jumper on the WiShield to INT0 or DIG8 to select
233 /// the arduino pin to use for WiShield interrupts, and also to make sure it agrees with the settings of
234 /// USE_DIG0_INTR or USE_DIG8_INTR in spi.h in the WiShield library (which defaults to
235 /// using Arduino digital pin 2, and which means setting the WiShield jumper to INT0 setting). Yes, the naming
236 /// conventions are inconsistent :-(. In summary:
237 /// \code
238 /// WiShield jumper spi.h Arduino
239 /// INT0 USE_DIG0_INTR Digital pin 2
240 /// D8 USE_DIG8_INTR Digital pin 8
241 /// \endcode
242 ///
243 /// For YellowJacket and WiFi Bee (which has no jumper), leave it as USE_DIG0_INTR.
244 ///
245 /// Caution: on WiFi Bee, Arduino Digital pin 4 is connected to the WiFi Chip HIBERNATE pin.
246 /// Do not use pin D4 as an RCKit output pin.
247 ///
248 /// In order for WiShield library to support UDP (as needed by this module),
249 /// you MUST set UIP_CONF_UDP to 1 in uip-conf.h. This is an unfortunate but necessary requirement,
250 /// otherwise UDP support will not be compiled into the WiShield library.
251 /// Further, you must edit apps-conf.h and make sure the only APP_* defined is APP_UDPAPP.
252 /// Failure to do this will cause compile errors.
253 ///
254 /// A modified version of the WiShield library already
255 /// modified and configured for use with RCKit (including RSSI support) is available at
256 /// http://www.airspayce.com/mikem/arduino/WiShield-v1.3.0-0-mikem-RCKit.zip
257 ///
258 /// WiShield will work with Arduino Mega, but with difficulty. The problem is that with the Mega, the SPI
259 /// pins that are required for interface with WiShield come out on different pins to the smaller form
260 /// factor arduinos like Diecimila and Duemilanove. So, to make the Mega work with the WiShield, you
261 /// have to reroute the SPI pin to different Arduino pins, as per
262 /// http://asynclabs.com/forums/viewtopic.php?f=13&t=19&hilit=mega&start=10
263 ///
264 /// By default, WiShieldTransceiver is configured as an Ad-Hoc Wi-Fi network with SSID of 'RCArduino'
265 /// By default, the network is Open (ie no encryption) and
266 /// It is configured with a static IP address of 169.254.1.100.
267 /// These setting can be changed by editing WiShieldTransceiver.cpp in the RCKit distribution.
268 ///
269 /// \author Mike McCauley (mikem@airspayce.com)
270 /// Do not contact the author directly unless it is to discuss commercial licensing.
271 /// See above for support and discussion groups.
272 ///
273 /// This software and the RCOIP protocol is Copyright (C) 2010-20112 Mike McCauley. Use is subject to license
274 /// conditions. The main licensing options available are GPL V2 or Commercial:
275 ///
276 /// This library has been tested with Duemilanove and (WiShield 1.0 or YellowJacket or WiFi Bee 1)
277 /// and iPhone 3.0
278 ///
279 /// \par Open Source Licensing GPL V2
280 ///
281 /// This is the appropriate option if you want to share the source code of your
282 /// application with everyone you distribute it to, and you also want to give them
283 /// the right to share who uses it. If you wish to use this software under Open
284 /// Source Licensing, you must contribute all your source code to the open source
285 /// community in accordance with the GPL Version 2 when your application is
286 /// distributed. See http://www.gnu.org/copyleft/gpl.html
287 ///
288 /// \par Commercial Licensing
289 ///
290 /// This is the appropriate option if you are creating proprietary applications
291 /// and you are not prepared to distribute and share the source code of your
292 /// application. Contact info@airspayce.com for details.
293 ///
294 /// \par Revision History
295 ///
296 /// \version 1.0 Initial release
297 /// \version 1.1 Added Linear
298 /// \version 1.2 Compiles under Arduino 1.0
299 /// \version 1.3 Fix error in test suite tat prevvented correct tests with latest versions of AccelStepper
300 /// Added documentation for examples.
301 /// Added new class MotorControllerSetter, which can be used to control motor controllers with
302 /// a direction and (PWM) speed pin.
303 /// \version 2.0 Caution: API Change: existing RCRx sketches will not work with this new version without (minor)
304 /// modifications.
305 /// Separate the WiShield WiFi driver code out into a separate Transceiver object.
306 /// Rationalise some includes and headers
307 /// Add support for WiShield and Ethernet transceivers, with examples to suit
308 /// \version 2.1 Some files were missing from the 2.0 release. Clarified the fact that only Arduino 1.0 and
309 /// later is now suported (due to incompatible changes in Ethernet UDP support)
310 /// \version 2.2 Compiler problems were reported unless SPI.h was include first in sketches (although
311 /// I could not reproduce this). Changed examples to suit.
312 /// \version 2.3 Found and documented a problem when you use Arduino digital pin D4 as an output with
313 /// WiFi-Bee, which uses that pin as HIBERNATE. Dont use D4 as output with WiFi-Bee
314 /// \version 2.4 Fixed incorrect link to RCTx on App Store.
315 /// \version 2.5 Updated author and distribution location details to airspayce.com
316 /// \version 2.6 2018-09-18 Added support for ESP8266 WiFi.
317 /// WiShield support is now obsolete and disabled by default.
318 /// \version 2.7 Allow to still build in non ESP8266 environment. <br>
319 /// Updated links to videos.
320 
321 #ifndef RCRx_h
322 #define RCRx_h
323 
324 #if (ARDUINO < 100)
325 #include "WProgram.h"
326 #else
327 #include "Arduino.h"
328 #endif
329 
330 class Setter;
331 class Transceiver;
332 
333 // If you require support for the obsolete WiShield devices, remove the comments on the line below
334 // #define RCRX_REQUIRE_WISHIELD
335 
336 /////////////////////////////////////////////////////////////////////
337 /// \class RCRx RCRx.h <RCRx.h>
338 /// \brief Remote Control Receiver module for RCOIP protocol on Arduino.
339 ///
340 /// \par Overview
341 /// This class implements a receiver for RCOIP (Remote Control Over IP). It starts and manages a
342 /// WiFi receiver, which receives UDP messages containing RCOIP commands such as remote control channel
343 /// values. When channel setting commands are received they are translated into output values which are sent
344 /// to Setter objects to control the phycical output devices and pins on the Arduino.
345 /// Supports WiShield 1.0 etc.
346 ///
347 /// \par Outputs
348 /// RCRx maps RCOIP channels to physical output devices through the analogOutputs array. This is an array
349 /// of Setter objects, one for each physical output to be controlled by RCRx. Whenever a RCOIP message
350 /// is received with new channel settings, the input() function of each Setter with new data will be
351 /// called. This will cause each Setter to set its physical output in response to the remote control
352 /// data received by an RCOIP.
353 ///
354 /// \par Failsafe
355 /// RCRx supports failsafe behaviour if a connection to the transmitter is lost.
356 /// RCRx monitors the time of each received RCOIP request. If no request is received for more than
357 /// failInterval milliseconds, it will be considered as disconnected, and the failsafe() function of
358 /// every Setter will be called, allowing each Setter to adopt its failsafe configuration
359 /// (eg throttle to 0 etc). This allows remote control vehicles to fail safe if the transmitter
360 /// fails or goes out of range.
361 class RCRx
362 {
363 public:
364  /// Constructor.
365  /// After contruction and initialisation, call the init() and run() functions.
366  RCRx();
367 
368  /// Tells this object where to find the transceiver object.
369  /// RCRx requires an instance of a Transceiver object for the device that you are using to
370  /// Received RCOIP requests from the transmitter.
371  /// A number of Transceivers are provided with RCRx:
372  /// - WiShieldTransceiver for WiFi transport with WiSheild
373  /// - EthernetTransceiver for Ethernet transport with Ethernet shield
374  /// or you can define your own.
375  void setTransceiver(Transceiver* transceiver);
376 
377  /// Specifies the Setters that will be used by this receiver to set its output values
378  /// Whenever a RCOIP message is received with a new value for channel n, it will be passed
379  /// to the Setter at index n by calling the Setters input() function.
380  /// \param[in] analogOutputs Pointer to an array pointers to Setter objects.
381  /// \param[in] numAnalogOutputs Number of elements in analogOutputs
382  void setOutputs(Setter** analogOutputs, uint8_t numAnalogOutputs);
383 
384  /// Set the output for channel n. Calls the Setter at index n of the analogOutputs
385  /// array. Not usuallly called exernally, this is usually only called
386  /// from within RCRx. Subclasses can override this to get control
387  /// when new analog output values become available
388  /// \param[in] channel The analog channel number output to set
389  /// \param[in] value The new value to set
390  virtual void setAnalogOutput(uint8_t channel, int value);
391 
392  /// Initialises the wireless WiFi receiver
393  /// Call once at startup time after addresses etc have been configured.
394  void init();
395 
396  /// Call this to process pending Wireless events. Call this as often as possible in your
397  /// main loop. Runs the wireless driver stack or whatever in the Transceiver,
398  /// and does internal housekeeping.
399  void run();
400 
401  /// Call to handle an incoming UDP message containing an RCOIP command message.
402  /// This is usually only called from the Transceiver, but could be called externally
403  /// for testing purposes etc.
404  /// \param[in] msg Pointer to the RCOIP message
405  /// \param[in] len Length of the PCOIP mesage in bytes
406  /// \param[in] rssi Receiver Signal Strength as reported by the WiFi receiver (if any)
407  /// when the message was received.
408  void handleRequest(uint8_t *msg, uint16_t len, uint16_t rssi);
409 
410  /// Called by RCRx when no RCOIP message has been received for more than failInterval milliseconds.
411  /// Calls the failsafe function for all configured output Setters.
412  void failsafe();
413 
414  /// Called by RCRx periodically (typically twice per second) to do period processing such as
415  /// detecting loss of incoming messages
416  void periodicTask();
417 
418  /// Returns whether the RCRx considers itself to be connected to the transmitter.
419  /// Initialsed to false. Whenever an RCOIP request is receved, set to true. If no RCOIP request
420  /// is receved for more than failInterval miliseconds, set to false.
421  /// \return true if the RCRx is still receiving messages from the transmitter.
422  boolean connected();
423 
424  /// Sends an RCOIP reply message
425  /// Usually called internally at most once every _replyInterval milliseconds.
426  void sendReply();
427 
428 protected:
429 
430 private:
431  /// The transceiver
432  Transceiver* _transceiver;
433 
434  /// Array of output Setters
435  Setter** _analogOutputs;
436 
437  /// Number of Setters in _analogOutputs
438  uint8_t _numAnalogOutputs;
439 
440  /// Arduino analog input pin which yields the arduino battery voltage
441  uint8_t _batteryVoltageAnalogPin;
442 
443  /// Max time in milliseconds between RCOIP replies
444  unsigned int _replyInterval;
445 
446  /// Max time in milliseconds between received request before RCRx is considered to be disconnected
447  unsigned int _failInterval;
448 
449  /// The time we last got a RCOIP request from the transmitter
450  unsigned long _lastRequestTime;
451 
452  /// The last time we sent a RCOIP reply to the transmitter
453  unsigned long _lastReplyTime;
454 
455  /// Whether RCRx is considered to be connected to the transmitter
456  boolean _connected;
457 
458  /// The value of the RSSI (receiver signal strength indicator)
459  /// in the last request received
460  uint16_t _rssi;
461 };
462 
463 /// @example DifferentialRCRx.pde
464 /// This simple example handles 3 RCOIP receiver channels. Its configured like this:
465 /// 1 Differential motor driver (receiver channels 0 and 1) driving 4 analog outputs configured as 2 HBridges
466 /// 1 Digital output (horn) (receiver channel 4)
467 /// This is the program used for the tank shown in http://www.airspayce.com/mikem/arduino/RCKit/tank.mp4
468 
469 /// @example HBridge2RCRx.pde
470 /// This simple example handles 3 RCOIP receiver channels. Its configured like this:
471 /// This is the program used for the car shown in http://www.airspayce.com/mikem/arduino/RCKit/car1.mp4
472 
473 /// @example HBridgeRCRx.pde
474 /// This simple example handles 4 RCOIP receiver channels. Its configured like this:
475 /// 2 Servos (receiver channels 0, 1) (left joystick on RCTx)
476 /// 1 HBridge (receiver channel 3) driving 2 analog outputs (right joystick on RCTx)
477 /// 1 Digital output (horn) (receiver channel 4)
478 
479 /// @example RCRxESP8266.ino
480 /// Receives RCOIP commmands from the built-in WiFi device on an ESP8266 and uses them to set servo
481 /// and digital outputs.
482 /// This simple example handles 5 RCOIP receiver channels. Its configured like this:
483 /// 4 Servos (receiver channels 0, 1, 2, 3)
484 /// 1 Digital output (horn) (receiver channel 4)
485 
486 /// @example RCRxWiShield.pde
487 /// OBSOLETE.
488 /// Receives RCOIP commmands from a WiShield and uses them to set servo
489 /// and digital outputs.
490 /// This simple example handles 5 RCOIP receiver channels. Its configured like this:
491 /// 4 Servos (receiver channels 0, 1, 2, 3)
492 /// 1 Digital output (horn) (receiver channel 4)
493 
494 /// @example RCRxEthernet.pde
495 /// Receives RCOIP commmands on Ethernet and uses them to set servo
496 /// and digital outputs.
497 /// This simple example handles 5 RCOIP receiver channels. Its configured like this:
498 /// 4 Servos (receiver channels 0, 1, 2, 3)
499 /// 1 Digital output (horn) (receiver channel 4)
500 
501 /// @example TestSuite.pde
502 /// Self test suite for RCKit classes
503 
504 
505 #endif
RCRx::run
void run()
Definition: RCRx.cpp:62
RCRx::RCRx
RCRx()
Definition: RCRx.cpp:18
Transceiver::init
virtual void init()
RCOIPv1ReplyReceiverStatus::version
uint8_t version
Definition: RCOIP.h:215
Setter::input
virtual void input(int value)
This is where incoming values are set.
Definition: Setter.cpp:26
RCRx::failsafe
void failsafe()
Definition: RCRx.cpp:111
RC_VERSION1
#define RC_VERSION1
Definition: RCOIP.h:155
RCRx::setOutputs
void setOutputs(Setter **analogOutputs, uint8_t numAnalogOutputs)
Definition: RCRx.cpp:42
RCOIP.h
RCOIPv1CmdSetAnalogChannels::version
uint8_t version
Definition: RCOIP.h:192
RCOIP_DEFAULT_REPLY_INTERVAL
#define RCOIP_DEFAULT_REPLY_INTERVAL
Definition: RCOIP.h:164
RCRx::sendReply
void sendReply()
Definition: RCRx.cpp:70
Setter::failsafe
virtual void failsafe()
Definition: Setter.cpp:33
RCRx::handleRequest
void handleRequest(uint8_t *msg, uint16_t len, uint16_t rssi)
Definition: RCRx.cpp:84
RCRx::setAnalogOutput
virtual void setAnalogOutput(uint8_t channel, int value)
Definition: RCRx.cpp:49
RCOIPv1CmdSetAnalogChannels
SetAnalogChannels command message structure.
Definition: RCOIP.h:188
RCOIPv1ReplyReceiverStatus
ReceiverStatus reply message structure.
Definition: RCOIP.h:211
RCOIP_DEFAULT_FAIL_INTERVAL
#define RCOIP_DEFAULT_FAIL_INTERVAL
Definition: RCOIP.h:169
RCOIPv1CmdSetAnalogChannels::channels
uint8_t channels[0]
Definition: RCOIP.h:200
Transceiver::run
virtual void run()
Transceiver::setDelegate
virtual void setDelegate(RCRx *delegate)
Definition: Transceiver.cpp:12
RCRx::periodicTask
void periodicTask()
Definition: RCRx.cpp:122
Transceiver
Abstract base class for a transceiver device that will send and receive messages on behalf of RCRx cl...
Definition: Transceiver.h:25
RCRx
Remote Control Receiver module for RCOIP protocol on Arduino.
Definition: RCRx.h:361
RC_VERSION
#define RC_VERSION
Definition: RCOIP.h:159
RCRx::connected
boolean connected()
Definition: RCRx.cpp:104
RCOIPv1ReplyReceiverStatus::batteryVoltage
uint8_t batteryVoltage
Definition: RCOIP.h:223
Transceiver::sendReply
virtual void sendReply(uint8_t *msg, uint16_t len)
RCRx::setTransceiver
void setTransceiver(Transceiver *transceiver)
Definition: RCRx.cpp:35
Setter
Virtual base class for classes that receive a value, maybe transform it and then do something with it...
Definition: Setter.h:25
RCOIPv1ReplyReceiverStatus::RSSI
uint8_t RSSI
Definition: RCOIP.h:219
RCRx::init
void init()
Definition: RCRx.cpp:56