You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Read the number of a given channel and convert to the range provided.
// If the channel is off, return the default value
int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) {
uint16_t ch = ibus.readChannel(channelInput);
if (ch < 100) return defaultValue;
return map(ch, 1000, 2000, minLimit, maxLimit);
}
// Read the channel and return a boolean value
bool readSwitch(byte channelInput, bool defaultValue) {
int intDefaultValue = (defaultValue) ? 100 : 0;
int ch = readChannel(channelInput, 0, 100, intDefaultValue);
return (ch > 50);
}
I use it on an esp32 based board (Waveshare General Driver for Robots) using esp32 Dev Module on Arduino IDE. and i get the following errror on compilation.
A fatal error occurred: Serial data stream stopped: Possible serial noise or corruption.
Failed uploading: uploading error: exit status 2
I connected the pins as instruxted.
The text was updated successfully, but these errors were encountered:
`#include <IBusBM.h>
// Create iBus Object
IBusBM ibus;
// Read the number of a given channel and convert to the range provided.
// If the channel is off, return the default value
int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) {
uint16_t ch = ibus.readChannel(channelInput);
if (ch < 100) return defaultValue;
return map(ch, 1000, 2000, minLimit, maxLimit);
}
// Read the channel and return a boolean value
bool readSwitch(byte channelInput, bool defaultValue) {
int intDefaultValue = (defaultValue) ? 100 : 0;
int ch = readChannel(channelInput, 0, 100, intDefaultValue);
return (ch > 50);
}
void setup() {
Serial.begin(115200);
Serial2.begin(115200);
ibus.begin(Serial2);
}`
I use it on an esp32 based board (Waveshare General Driver for Robots) using esp32 Dev Module on Arduino IDE. and i get the following errror on compilation.
A fatal error occurred: Serial data stream stopped: Possible serial noise or corruption.
Failed uploading: uploading error: exit status 2
I connected the pins as instruxted.
The text was updated successfully, but these errors were encountered: