Uwe Gartmann
/
SBUS-Library_16channel
Futaba S-BUS Library. Let you control 16 servos and 2 digital channels
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "FutabaSBUS.h" 00002 #include "TextLCD.h" 00003 #include "mbed.h" 00004 00005 DigitalOut mled(LED4); 00006 TextLCD lcd(p26, p25, p24, p23, p22, p20, p19, TextLCD::LCD20x4); 00007 FutabaSBUS sbus(p28, p27); 00008 00009 00010 int main() { 00011 sbus.passthrough(false); 00012 while (1) { 00013 sbus.servo(1,200); 00014 wait(0.5); 00015 sbus.servo(1,1700); 00016 wait(0.5); 00017 mled=!mled; 00018 00019 lcd.locate(0,0); 00020 lcd.printf("fs:"); 00021 lcd.printf("%i",sbus.failsafe()); 00022 lcd.printf(" "); 00023 00024 lcd.locate(0,1); 00025 lcd.printf("dg:"); 00026 lcd.printf("%i",sbus.digichannel(1)); 00027 lcd.printf("#"); 00028 lcd.printf("%i",sbus.digichannel(2)); 00029 lcd.printf(" "); 00030 00031 lcd.locate(0,2); 00032 lcd.printf("Q:"); 00033 lcd.printf("%i",sbus.channel(1)); 00034 lcd.printf(" "); 00035 00036 lcd.locate(10,2); 00037 lcd.printf("H:"); 00038 lcd.printf("%i",sbus.channel(2)); 00039 lcd.printf(" "); 00040 00041 lcd.locate(0,3); 00042 lcd.printf("G:"); 00043 lcd.printf("%i",sbus.channel(3)); 00044 lcd.printf(" "); 00045 00046 lcd.locate(10,3); 00047 lcd.printf("S:"); 00048 lcd.printf("%i",sbus.channel(4)); 00049 lcd.printf(" "); 00050 00051 } 00052 }
Generated on Tue Jul 12 2022 16:32:56 by 1.7.2