Commit 29f09200 authored by Frater's avatar Frater
Browse files

Update LED.MD

parent fcd24bf0
LED
All LEDs are in fact 2 LED (one red and one green) and seems to be connected to separated pins from the controller, or at least addressed by the controller like this
All LEDs are in fact 2 LED (one red and one green) and seems to be connected to separated pins from the controller, or at least can be addressed by the controller following this addresses design:
```
LED 1 (r) = 1
LED 1 (g) = 2
```
```
LED 2 (r) = 3
LED 2 (g) = 4
```
```
LED 3 (r) = 5
LED 3 (g) = 6
```
There is no zero LED
the commands to address the LED status is 0x1B 0x4C _STATUS_
_STATUS_ byte is divided in two parts:
4 high bits are used to define the LED id,
1 low bit is used to define the status (on/off)
So Led's can controlled with the following (pseudo-c) code:
```
#define LED_STATUS_ON 0x01
#define LED_STATUS_OFF 0x00
#define LED_1_RED 0x10
#define LED_1_GREEN 0x20
#define LED_2_RED 0x30
#define LED_2_GREEN 0x40
#define LED_3_RED 0x50
#define LED_3_GREEN 0x60
void SetLed(unsigned char ledid,unsigned char status)
{
unsigned char cmd[3];
the commands to address the LED status is 0x1B 0x4C _status_
cmd[0] = "\x1b";
cmd[1] = "\x4c";
cmd[2] = (unsigned char) (ledid + status);
Status byte was divided in two part 4 high bits define the LED id, and 4 low bits define
SerialPtr_writebuffer(cmd,3);
}
SetLed(LED_1_GREEN, LED_STATUS_ON);
```
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment