Hello All,
I'm new to this forum, so please excuse any potential errors in protocol.
I'm having two problems with a color sensing project. Both programs are standrd, already tried and true programs for the PicAxe. I'm running Windows 7 on my PC, and the Color sensor is from Taos as purchased through Parallax. I'm also using the Parallax cable and adaptor to a Kiwi Patch Board. I'm using an 8M2, running off of a 6 VDC battery pack. The program loads into the PicAxe, and the 2 LEDs on the color sensor flash once per second (assume while its taking a reading), but the information on the serial terminal is jibberish. I've tried all possibile baud settings, including the special one for the USB to serial cable (PixAxe part 027).
********************************************
‘ PICAXE-08M2 input/output pins
symbol LED = 0 ‘ Color sensor white LEDs (output 0)
symbol S2 = 1 ‘ Color sensor select S2 (output 1)
symbol ser = 2 ‘ Servo or serial LCD (output 2)
symbol CSI = 3 ‘ Color sensor pulse (input 3)
symbol S3 = 4 ‘ Color sensor select S3 (output 4)
‘ ********************************************
‘ Variables
symbol red_value = w4 ‘ Color sensor red content
symbol blue_value = w5 ‘ Color sensor blue content
symbol green_value = w6 ‘ Color sensor green content
‘ Remember w4-w6 uses b8-b13!
‘ ********************************************
‘ scan and display every second
main:
gosub color ‘ scan the colour
sertxd ("Red =", 9, #red_value, 9)
sertxd ("Blue =", 9, #blue_value, 9)
sertxd ("Green =", 9, #green_value, CR, LF)
pause 1000
goto main
‘ ********************************************
‘ sub to scan colors
color:
high LED ‘ LED on
low S2 ‘ read red into w4
low S3
count 3, 50, red_value
high S3 ‘ read blue into w5
count 3, 50, blue_value
high S2 ‘ read green into w6
count 3, 50, green_value
low LED ‘ LED off
return
My second problem is another PicAxe color program where I want to hook up a serial LCD to the project. The problem is a syntax error that I can't get by. The program is below:
********************************************
‘ PICAXE-08M input/output pins
symbol LED = 0 ‘ Colour sensor white LEDs (output 0)
symbol S2 = 1 ‘ Colour sensor select S2 (output 1)
symbol ser = 2 ‘ Servo or serial LCD (output 2)
symbol CSI = 3 ‘ Colour sensor pulse (input 3)
symbol S3 = 4 ‘ Colour sensor select S3 (output 4)
‘ ********************************************
‘ Variables
symbol red_value = w4 ‘ Color sensor red content
symbol blue_value = w5 ‘ Color sensor blue content
symbol green_value = w6 ‘ Color sensor green content
‘ Remember w4-w6 uses b8-b13!
‘ ********************************************
‘ scan and display every second
main:
gosub color ‘ scan the colour
serout 2,N2400,(254,128"R=",#red_value, " ")
serout 2,N2400,(254,136"B=",#blue_value, " ")
serout 2,N2400,(254,192"G=",#green_value, " ")
pause 1000
goto main
‘ ********************************************
‘ sub to scan colours
color:
high LED ‘ LED on
low S2 ‘ read red into w4
low S3
count 3, 50, red_value
high S3 ‘ read blue into w5
count 3, 50, blue_value
high S2 ‘ read green into w6
count 3, 50, green_value
low LED ‘ LED off
return
The Syn tax error is a compile error: serout 2,N2400,(254,128"R=",#red_value, " ")
The "^" symbol is below the comma just before the # symbol
Error: Syntax error in this line!
Any help for either problem would be appreciated.
Sincerely,
Fierojo
I'm new to this forum, so please excuse any potential errors in protocol.
I'm having two problems with a color sensing project. Both programs are standrd, already tried and true programs for the PicAxe. I'm running Windows 7 on my PC, and the Color sensor is from Taos as purchased through Parallax. I'm also using the Parallax cable and adaptor to a Kiwi Patch Board. I'm using an 8M2, running off of a 6 VDC battery pack. The program loads into the PicAxe, and the 2 LEDs on the color sensor flash once per second (assume while its taking a reading), but the information on the serial terminal is jibberish. I've tried all possibile baud settings, including the special one for the USB to serial cable (PixAxe part 027).
********************************************
‘ PICAXE-08M2 input/output pins
symbol LED = 0 ‘ Color sensor white LEDs (output 0)
symbol S2 = 1 ‘ Color sensor select S2 (output 1)
symbol ser = 2 ‘ Servo or serial LCD (output 2)
symbol CSI = 3 ‘ Color sensor pulse (input 3)
symbol S3 = 4 ‘ Color sensor select S3 (output 4)
‘ ********************************************
‘ Variables
symbol red_value = w4 ‘ Color sensor red content
symbol blue_value = w5 ‘ Color sensor blue content
symbol green_value = w6 ‘ Color sensor green content
‘ Remember w4-w6 uses b8-b13!
‘ ********************************************
‘ scan and display every second
main:
gosub color ‘ scan the colour
sertxd ("Red =", 9, #red_value, 9)
sertxd ("Blue =", 9, #blue_value, 9)
sertxd ("Green =", 9, #green_value, CR, LF)
pause 1000
goto main
‘ ********************************************
‘ sub to scan colors
color:
high LED ‘ LED on
low S2 ‘ read red into w4
low S3
count 3, 50, red_value
high S3 ‘ read blue into w5
count 3, 50, blue_value
high S2 ‘ read green into w6
count 3, 50, green_value
low LED ‘ LED off
return
My second problem is another PicAxe color program where I want to hook up a serial LCD to the project. The problem is a syntax error that I can't get by. The program is below:
********************************************
‘ PICAXE-08M input/output pins
symbol LED = 0 ‘ Colour sensor white LEDs (output 0)
symbol S2 = 1 ‘ Colour sensor select S2 (output 1)
symbol ser = 2 ‘ Servo or serial LCD (output 2)
symbol CSI = 3 ‘ Colour sensor pulse (input 3)
symbol S3 = 4 ‘ Colour sensor select S3 (output 4)
‘ ********************************************
‘ Variables
symbol red_value = w4 ‘ Color sensor red content
symbol blue_value = w5 ‘ Color sensor blue content
symbol green_value = w6 ‘ Color sensor green content
‘ Remember w4-w6 uses b8-b13!
‘ ********************************************
‘ scan and display every second
main:
gosub color ‘ scan the colour
serout 2,N2400,(254,128"R=",#red_value, " ")
serout 2,N2400,(254,136"B=",#blue_value, " ")
serout 2,N2400,(254,192"G=",#green_value, " ")
pause 1000
goto main
‘ ********************************************
‘ sub to scan colours
color:
high LED ‘ LED on
low S2 ‘ read red into w4
low S3
count 3, 50, red_value
high S3 ‘ read blue into w5
count 3, 50, blue_value
high S2 ‘ read green into w6
count 3, 50, green_value
low LED ‘ LED off
return
The Syn tax error is a compile error: serout 2,N2400,(254,128"R=",#red_value, " ")
The "^" symbol is below the comma just before the # symbol
Error: Syntax error in this line!
Any help for either problem would be appreciated.
Sincerely,
Fierojo