This is embarrassing
wirecutter
Posts: 22
Hello,
I am working through a book on spin programming and this bug popped up,.
"ERROR: Expected an instructio or variable"
In this section that reads:
pub Go
dira [output_pin]~~ ' set pin to output
outa [output_pin]~ ' make pin low output
dira [input_pin]~ ' set pin to input
repeat
if ina[input_pin]==0 ' check pin for high or low
turnOn_LED ' method call
else
turnOff_LED ' method call
It tells me the line " turnOn_LED" has the error
I typed it exactly as in book, can someone explain what is wrong?
it wont let me archive it.
thanks,
wirecutter
I am working through a book on spin programming and this bug popped up,.
"ERROR: Expected an instructio or variable"
In this section that reads:
pub Go
dira [output_pin]~~ ' set pin to output
outa [output_pin]~ ' make pin low output
dira [input_pin]~ ' set pin to input
repeat
if ina[input_pin]==0 ' check pin for high or low
turnOn_LED ' method call
else
turnOff_LED ' method call
It tells me the line " turnOn_LED" has the error
I typed it exactly as in book, can someone explain what is wrong?
it wont let me archive it.
thanks,
wirecutter
Comments
Here is the full code.
{{ 12 sep 09 Harprit Sandhu
ButtonLED.spin
Propeller Tool 1.2.6
Chapter 15 program 1
Program turns on LED if input has been pulled up is grounded
}}
con
_clkmode = xtal1 + pll2x ' system clock spec
_xinfreq = 5_000_000
input_pin = 23 ' input pin
output_pin = 27 ' output pin
inv_high = 0 ' invert high state
inv_low = 1 ' invert low state
pub Go
dira [output_pin]~~ ' set pin to output
outa [output_pin]~ ' make pin low output
dira [input_pin]~ ' set pin to input
repeat
if ina[input_pin]==0 ' check pin for high or low
turnOn_LED ' method call
else
turnOff_LED ' method call
PRI turn_On_LED ' method to set the LED line high
outa[output_pin] :=inv_high ' sets the LED high
PRI turn_Off_LED ' method to set the LED line low
outa[output_pin] :=inv_high ' sets the LED low
The book is called "Programming the propeller with spin"
Tab book ISBN# 978-0-07-171666-6
Thanks,
wirecutter
thanks
wirecutter