Shop OBEX P1 Docs P2 Docs Learn Events
ColorPAL won't stop flashing color — Parallax Forums

ColorPAL won't stop flashing color

jacquelinevl03jacquelinevl03 Posts: 18
edited 2017-01-08 17:44 in BASIC Stamp
Help!! I want to program the ColorPAL sensor, but it won't stop flashing light. I ran sample programs on the ColorPAL, but now they don't seem to stop. Please help, I would like to detect color, not flash color.


Thank you

This is the code that I think keeps running. The ColorPAL keeps flashing colors even though I did run the program, or even if it is not connected to Pin15. As long as it has power it flashes colors.

' =========================================================================
'
' File...... ColorPAL_flicker.bs2
' Purpose... ColorPAL flickering candle imitator.
' Author.... Phil Pilgrim -- Bueno Systems, Inc.
' E-mail.... propeller@phipi.com
' Started... 17 Apr 2009
' Updated... 26 Jan 2010: Changed reset delay from 50 ms. to 80ms.
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' =========================================================================

'
[ Program Description ]

' This program programs the ColorPAL to imitate a flickering candle.
' Once programmed, it will run standalone with just +5V and ground
' connections.

'
[ I/O Definitions ]

sio PIN 15 ' Serial I/O com pin for ColorPAL.

'
[ Constants ]

' Baudrate definitions. Serial I/O must be open-drain. The ColorPAL includes
' a pullup internally.

#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
baud CON 119 + 32768
#CASE BS2SX, BS2P
baud CON 327 + 32768
#CASE BS2PX
baud CON 536 + 32768
#ENDSELECT

'
[ Variables ]

red VAR Word ' Received RGB values from ColorPAL.
grn VAR Word
blu VAR Word

'
[ Initialization ]

GOSUB Reset ' Reset the ColorPAL and enter direct command mode.

'
[ Program Code ]

SEROUT sio, baud, ["= (00 ?05 Y t09 F t05 r404000 t09 ) #00"]
PAUSE 1000
SEROUT sio, baud, ["!"]
DO:LOOP

'
[ Subroutines ]

' Reset: Sends a long break to reset ColorPAL and enter direct command mode.

Reset:
LOW sio 'Pull sio low to eliminate any residual charge.
INPUT sio 'Return pin to input.
DO UNTIL sio : LOOP 'Wait for pin to be pulled high by ColorPAL.
LOW sio 'Pull pin low.
PAUSE 80 'Keep low for 80ms to enter Direct mode.
INPUT sio 'Return pin to input.
PAUSE 10 'Pause another 10ms
RETURN

Comments

  • Welcome to the forums!

    Could you post the code that you are using that creates the problem?

  • ' =========================================================================
    '
    ' File...... ColorPAL_flicker.bs2
    ' Purpose... ColorPAL flickering candle imitator.
    ' Author.... Phil Pilgrim -- Bueno Systems, Inc.
    ' E-mail.... propeller@phipi.com
    ' Started... 17 Apr 2009
    ' Updated... 26 Jan 2010: Changed reset delay from 50 ms. to 80ms.
    '
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '
    ' =========================================================================

    '
    [ Program Description ]

    ' This program programs the ColorPAL to imitate a flickering candle.
    ' Once programmed, it will run standalone with just +5V and ground
    ' connections.

    '
    [ I/O Definitions ]

    sio PIN 15 ' Serial I/O com pin for ColorPAL.

    '
    [ Constants ]

    ' Baudrate definitions. Serial I/O must be open-drain. The ColorPAL includes
    ' a pullup internally.

    #SELECT $STAMP
    #CASE BS2, BS2E, BS2PE
    baud CON 119 + 32768
    #CASE BS2SX, BS2P
    baud CON 327 + 32768
    #CASE BS2PX
    baud CON 536 + 32768
    #ENDSELECT

    '
    [ Variables ]

    red VAR Word ' Received RGB values from ColorPAL.
    grn VAR Word
    blu VAR Word

    '
    [ Initialization ]

    GOSUB Reset ' Reset the ColorPAL and enter direct command mode.

    '
    [ Program Code ]

    SEROUT sio, baud, ["= (00 ?05 Y t09 F t05 r404000 t09 ) #00"]
    PAUSE 1000
    SEROUT sio, baud, ["!"]
    DO:LOOP

    '
    [ Subroutines ]

    ' Reset: Sends a long break to reset ColorPAL and enter direct command mode.

    Reset:
    LOW sio 'Pull sio low to eliminate any residual charge.
    INPUT sio 'Return pin to input.
    DO UNTIL sio : LOOP 'Wait for pin to be pulled high by ColorPAL.
    LOW sio 'Pull pin low.
    PAUSE 80 'Keep low for 80ms to enter Direct mode.
    INPUT sio 'Return pin to input.
    PAUSE 10 'Pause another 10ms
    RETURN
  • I think it keeps running this flicker program. Even if the ColorPAL is not connected to Pin15 it keeps on running. As long as it has power it keeps on flashing and I do not know how to make it stop flashing, so that I can sense colors with the ColorPAL sensor.
  • PublisonPublison Posts: 12,366
    edited 2017-01-08 18:34
    I think it keeps running this flicker program. Even if the ColorPAL is not connected to Pin15 it keeps on running. As long as it has power it keeps on flashing and I do not know how to make it stop flashing, so that I can sense colors with the ColorPAL sensor.

    When you run a program on the BS2, it is save to the EEPROM on the chip. Every time you power up, it will run that program. To make it stop flashing, and sense colors, you need to load another program in the Basic Stamp Tool, such as the programs found here:

    https://www.parallax.com/downloads/colorpal-color-matching-program-and-basic-stamp-sample-files



  • Those are the programs I have downloaded, when I run the sense program from that zip file it still flashes the colors.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2017-01-08 21:30
    Just to be clear, when you run, say, colorPAL_sense.bs2, with the ColorPAL and P15 connected, it still flickers? With the sense program running, it will still produce continuous flashes of color so it can read the RGB components. But you should see output in your DEBUG screen.

    -Phil
  • When I run the colorPAL_sense.bs2 with the ColorPAL and P15 connected, as you said, it flickers green, yellow, and red light. When I run the program the debugger window does pop up, so I put a green paper in front of the ColorPAL and the DEBUG screen does not give me any output.
  • I believe I have the exact same problem as kazuya86.
    http://forums.parallax.com/discussion/157618/colorpal-28380
    I tried your solution to him Phil Pilgrim, but it gave me the error of: "Expected a constant, variable, unary operator, or ("
  • Publison,
    Yes, that is the program I am using.
  • I tried your solution to him Phil Pilgrim, but it gave me the error of: "Expected a constant, variable, unary operator, or ("

    Which line of the program gives you this error?

    -Phil
  • SEROUT sio, baud, SEROUT sio, baud, ["= #00"]
    When it gives out the error code it highlights the second SEROUT.
    I tried your solution to him Phil Pilgrim, but it gave me the error of: "Expected a constant, variable, unary operator, or ("

    Which line of the program gives you this error?

    -Phil

    1274 x 697 - 91K
  • Somehow a second SEROUT sio, baud, got duplicated in that line. Just delete it.

    -Phil
  • jacquelinevl03jacquelinevl03 Posts: 18
    edited 2017-01-29 01:13
    Thank you! I was able to run the program, the ColorPAL stopped flashing colors. But I am not sure if the sensor is working now. How can I test that it is fine?
  • I ran the flicker, mimic, sense, and transit programs and now the ColorPAL does not do anything. Could I have damaged the sensor? Or is it the programming?
  • Unless you plugged it in somewhere you shouldn't have, you didn't break it.

    -Phil

  • When I ran the program I noticed I had the Pin connection in the wrong slot in the breadboard (right next to the place it should have been in. I did not connect it to the Voltage or Ground, it was just in a slot that had no connection.) so I connected it to the correct pin and it stopped flashing the color. Now it won't respond to programs like flicker, how can I check if the sensor is fine. Or maybe the code that was used made it stop flashing color completely, I am not sure.
    2304 x 1296 - 1M
    2304 x 1296 - 913K
    2304 x 1296 - 936K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2017-01-29 07:07
    Your black wire is connected to Vin, rather than Vss. This would result in a reverse voltage powering the ColorPAL, which in all likelihood has fried it. But ... you may get lucky and not have any permanent damage. Fix your connection, try it, and see.

    -Phil
  • jacquelinevl03jacquelinevl03 Posts: 18
    edited 2017-01-29 18:57
    .
  • Thank you so much!! The ColorPAL is reacting now!
  • ercoerco Posts: 20,257
    Hooray, PhiPi saves the day again! Always nice to see happy outcomes to these problems.
    This would result in a reverse voltage powering the ColorPAL, which in all likelihood has fried it.

    Fry pork bellies, not Colorpals. Sensor lives matter!

Sign In or Register to comment.