Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ protected override IEnumerable<byte[]> GetCommands(IList<(object key, Color colo
SerialConnection.ReadTo(Prompt);
byte[] channelLedCountCommand = [(byte)((i << 4) | COUNT_COMMAND[0])];
SendCommand(channelLedCountCommand);
int ledCount = SerialConnection.ReadByte();
int low = SerialConnection.ReadByte();
int high = SerialConnection.ReadByte();
int ledCount = low | (high << 8);
if (ledCount > 0)
yield return (i, ledCount);
}
Expand Down
12 changes: 8 additions & 4 deletions RGB.NET.Devices.WS281X/Sketches/RGB.NET_Arduino.ino
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,35 @@ void loop()

// ### channel 1 ###
case 0x11: // get led-count of channel 1
Serial.write(LEDS_CHANNEL_1);
Serial.write(lowByte(LEDS_CHANNEL_1));
Serial.write(highByte(LEDS_CHANNEL_1));
break;
case 0x12: // set leds of channel 1
Serial.readBytes(((uint8_t*)leds_channel_1), (LEDS_CHANNEL_1 * 3));
break;

// ### channel 2 ###
case 0x21: // get led-count of channel 2
Serial.write(LEDS_CHANNEL_2);
Serial.write(lowByte(LEDS_CHANNEL_2));
Serial.write(highByte(LEDS_CHANNEL_2));
break;
case 0x22: // set leds of channel 2
Serial.readBytes(((uint8_t*)leds_channel_2), (LEDS_CHANNEL_2 * 3));
break;

// ### channel 3 ###
case 0x31: // get led-count of channel 3
Serial.write(LEDS_CHANNEL_3);
Serial.write(lowByte(LEDS_CHANNEL_3));
Serial.write(highByte(LEDS_CHANNEL_3));
break;
case 0x32: // set leds of channel 3
Serial.readBytes(((uint8_t*)leds_channel_3), (LEDS_CHANNEL_3 * 3));
break;

// ### channel 4 ###
case 0x41: // get led-count of channel 4
Serial.write(LEDS_CHANNEL_4);
Serial.write(lowByte(LEDS_CHANNEL_4));
Serial.write(highByte(LEDS_CHANNEL_4));
break;
case 0x42: // set leds of channel 4
Serial.readBytes(((uint8_t*)leds_channel_4), (LEDS_CHANNEL_4 * 3));
Expand Down