Differences
This shows you the differences between two versions of the page.
en:toggledualcolorled [2014/07/01 17:21] ruppi created |
en:toggledualcolorled [2014/07/01 17:21] (current) ruppi |
||
---|---|---|---|
Line 1: | Line 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을 안드로이드 앱을 통해서 켜고 끈다. | ||
+ | = 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 | ||
+ | |||
+ | = Knowledge Base = | ||
+ | == 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 | ||
+ | |||
+ | {{:en:2led_symbol.png}} | ||
+ | |||
+ | * Mechanical diagram | ||
+ | |||
+ | {{:en:2led_mechanical.png}} | ||
+ | |||
+ | == Resistor == | ||
+ | Restricts the amount of current that can flow through a circuit. | ||
+ | * [http://www.audionotekits.com/resistorcodes.html | 5 band resistor color code calculator] | ||
+ | |||
+ | * Symbol | ||
+ | |||
+ | {{:en:resistor_symbol.png?60}} | ||
+ | |||
+ | = Circuit = | ||
+ | |||
+ | {{:en:Odroid_ADK_LED_1.png}} | ||
+ | {{:en:2LED.png}} | ||
+ | |||
+ | = Schematic = | ||
+ | |||
+ | {{:en: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. | ||
+ | |||
+ | = Video = | ||
+ | [http://youtu.be/s1gVRr7JeYw] | ||
+ | |||
+ | [[Play(http://www.youtube.com/embed/s1gVRr7JeYw?hl=ko&fs=1)]] | ||
+ | |||
+ | = Software = | ||
+ | * ADK [[br]] | ||
+ | svn check out[[br]] | ||
+ | http://dev.odroid.com/svn/accessory/trunk/ODROIDBluetoothLEDDemo [[br]] | ||
+ | |||
+ | * Bluetooth [[br]] | ||
+ | svn check out[[br]] | ||
+ | http://dev.odroid.com/svn/accessory/trunk/ODROIDAccessoryLEDDemo [[br]] | ||
+ | |||
+ | <code> | ||
+ | // 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; | ||
+ | </code> | ||
+ | send 5 byte buffers by bluetooth or usb | ||
+ | |||