public byte[] write()
	{
		byte[] toret;
		int cnt = 0;
		int xcnt = 0;

		if (rc == null)
		{
			toret = new byte[(int)2+bc.getNumControls()/8];
			toret[0] = 0;

			//Set the power down bit (2nd bit of first byte)
			if (bc.getPowerDown())
				toret[0] = (byte) (toret[0] | 2);

			//Sets the control bits (bytes 2->x)
			cnt = 1;
			while(cnt < (int)2+bc.getNumControls()/8)
			{
				xcnt = 0;
				toret[cnt] = 0;
				while(xcnt+cnt-1<bc.getNumControls())
				{
					if(bc.getControls(xcnt+cnt-1))
						toret[cnt] = (byte) (toret[cnt] | maskVal(xcnt));
					xcnt++;
				}
				cnt++;
			}
			
		}
		else
		{
			toret = new byte[3];
			toret[0] = 0;
			//Sets the power bytes
			if(rc.getPower()>=0)
			{
				toret[1] = (byte) (rc.getPower());
				toret[0] = (byte) (toret[0] | 2);
			}
			else
			{
				toret[1] = (byte) (rc.getPower()+100);
			}
			//Sets steering angle bytes
			if(rc.getAngle()>=0)
			{
				toret[2] = (byte) (rc.getAngle());
				toret[0] = (byte) (toret[0] | 4);
			}
			else
			{
				toret[2] = (byte) (rc.getAngle()+90);
			}
		}
		
		toret[0] = (byte) (toret[0] | 1);
		return toret;
	}