// RobotBuilder Version: 1.5
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.


package org.usfirst.frc2811.RecycleRush.subsystems;

import org.usfirst.frc2811.RecycleRush.Robot;


/** This system controls the lighting underneath the robot chassis
 * 
 */
public class UnderGlow extends CANTeensy {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
    
    /* Check the datasheets for your device for the arbitration IDs of the
    messages you want to send.  By convention, this is a bitstring
    containing the model number, manufacturer number, and api number. */
	protected static final int MESSAGE1_ARB_ID = 0x5500; //signs outgoing messages
	protected static final int MESSAGE2_ARB_ID = 0xAA00; //filter for incoming messages
	
	/*  Device ID, from 0 to 63. This should match the CAN address or filter on the remote end 
	 */
	protected static final int DEVICE_NUMBER = 0x22; //0x0-0x3F is allowed (0-63)
	protected static final int REPEAT_PERIOD = 100;
	//protected static final int REPEAT_PERIOD = CANJNI.CAN_SEND_PERIOD_NO_REPEAT;

    public void initDefaultCommand() {
        // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
        // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
	
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
    	
    	//enable logging of CAN writes
    	Robot.logger.setChannel("CAN", true);
    }

    
    
    
    public void setTeamColor(){
	//TODO read team color
	//setcolor to teamcolor
    }
    
    public void setPattern(){
	//TODO See what's happening with the robot state
	//do something interesting
	//setcolor to teamcolor
    }
    
    
    public void setColor(){
    	Robot.logger.channel("CAN","setColor: AA AA AA");
    	data.clear();
    	data.put((byte)0xAA);
    	data.put((byte)0xAA);
    	data.put((byte)0xAA);
    	sendCANData(); //breaks
    }
    
}

