Page 205 - Build Your Own Quadcopter_ Power Up Your Designs with the Parallax Elev-8
P. 205
184 Bu il d Y o ur O w n Q u a d c o p t e r
You should realize that the above code is totally useless unless referenced and used by
the top object, which is RX_demo. I once again modified RX_demo to use the LED program,
and I also added some logic to determine the appropriate LED lighting mode to call. This
code listing is abbreviated without the header or license information. I also added comments
in an italic font to highlight the LED_Control program changes.
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
LCD_PIN = 19
LCD_BAUD = 19_200
LCD_LINES = 4
VAR
long pulsewidth[4]
DAT
pins LONG 14, 15, 16, 17
OBJ
lcd : “debug_lcd”
RX : “RX”
servo : “Servo32v6”
num : “Simple_Numbers”
led : “LED_Control” ‘new reference “led” for
the LED_Control program
PUB Init
if lcd.init(LCD_PIN, LCD_BAUD, LCD_LINES)
lcd.cursor(0)
lcd.backLight(True)
lcd.cls
lcd.str(string(“RX Demo v0.1”))
led.init
waitcnt(clkfreq + cnt)
servo.start
Rxinput
PUB RXinput | i, pulse[4]
lcd.cls
RX.start(@pins,@pulseWidth)