skip menu and go to main content

body start

Android Accessory

Wiki

Project News

Project Info

  • User Interface: Other Interface
  • Member count : 8
  • Registered:  : 2011.07.26
  • Activity Percentile:  : 80%

activity viewforum,download view

1 Overview

There is one LED that is Dual Color LED Yellow-green and Red. Yellow-green LED on/off and Red LED on/off by Android App.

황록색 과 빨간색을 가지고 있는 2색 LED을 사용하여 황록색과 적색 LED을 안드로이드 앱을 통해서 켜고 끈다.

2 What you need

  • ADK Board
  • ADK IO Kit
    • Mini Breadboard
    • Cathode Common LED with Dual Color RED and Yellow-green x 1ea
    • 330 ohm Resistor x 2ea
    • jumper wires

3 Knowledge Base

3.1 Dual Color LED

A light-emitting diode (LED) is a semiconductor light source.
The following Mechanical diagram three different lengths of lead will be able to see that.
The longest lead is Cathode of common and the next longest is the anode of the red and It is the shortest, yellow-green of the anode.
* Symbol
2led_symbol.png


* Mechanical diagram
2led_mechanical.png


3.2 Resistor

Restricts the amount of current that can flow through a circuit.
* [http]| 5 band resistor color code calculator

* Symbol
resistor_symbol.png


4 Circuit

Odroid_ADK_LED_1.png
2LED.png


5 Schematic

LED2_sch.png


LED is constant voltage component and could go bad, if ate over current.
330ohm Two registers prevent 10mA over current from positive voltage to LED and connected in series.

7 Software



// initialize GPIO port
// if true, set GPIO output
initGPIO(LED_1_PORT, true);
initGPIO(LED_2_PORT, true);

//LEDContol
//send command message
//msg.what -> command character;
//msg.arg1 -> port number;
//msg.arg2 -> HIGH, LOW
Message ledUpdate = Message.obtain(uiHandler, ODROIDBluetoothLEDDemo.SEND_LETTER_GPIO_OUTPUT, mPort, on?1:0);


* ADK
	case SEND_LETTER_GPIO_OUTPUT:
                // check USB connection
                if(accessoryManager.isConnected() == false) {
                    return;
                }   
    
                commandPacket[0] = SEND_LETTER_GPIO_OUTPUT;
                commandPacket[1] = 0;
                commandPacket[2] = (byte) msg.arg1;
                commandPacket[3] = 0;
                if (msg.arg2 == HIGH)
                    commandPacket[4] = HIGH;
                else
                    commandPacket[4] = LOW;
    
                accessoryManager.write(commandPacket);    
                break;


* Bluetooth	
	case SEND_LETTER_GPIO_CONFIG:
                // check Bluetooth connection
		if (mCmdSendService.getState() != BluetoothMotorControlService.STATE_CONNECTED) {
			Toast.makeText(getBaseContext(), R.string.not_connected, Toast.LENGTH_SHORT)
			.show();					
			return;
		}
			
		if (commandPacket[0] != 0) {
			return;
		}
			
		commandPacket[0] = SEND_LETTER_GPIO_CONFIG;
		commandPacket[1] = 0;
		commandPacket[2] = (byte) msg.arg1;
		commandPacket[3] = 0;
		commandPacket[4] = (byte) msg.arg2;

		mCmdSendService.write(commandPacket);
		break;
send 5 byte buffers by bluetooth or usb