Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int led_t = 360;
- const int led_x = 100;
- int[,] r_preview = new int[led_t,led_x];
- int[,] g_preview = new int[led_t,led_x];
- int[,] b_preview = new int[led_t,led_x];
- //Assign some values to r_preview, g_preview, b_preview...
- private void Send_LED_Data(object sender, SerialDataReceivedEventArgs e) //Function for serial LED communication
- {
- SerialPort sp = (SerialPort)sender;
- if (sp.ReadChar() == 'a')
- {
- byte[] data = new byte[3*led_x+1];
- data[0] = (byte)(c_interval);
- for (int i = 0; i < led_x; i++)
- {
- data[i + 1] = (byte)(r_preview[index_of_array, i]);
- data[i + led_x+1] = (byte)(g_preview[index_of_array, i]);
- data[i + 2*led_x+1] = (byte)(b_preview[index_of_array, i]);
- }
- sp.Write(data, 0, 3*led_x+1);
- index_of_array=(index_of_array+1)%led_t;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment