So I recently "modded" my computer desk with some RGB LED strips under it to light up in colors. Right now, I have it going through the colors of the spectrum in a little program I wrote using the FastSPI library.
Now I want to challange my self a little bit more. I decided that I want to be able to control the light and different modes from my computer. I am a rpetty advanced C++ programmer, and want to use it along with SFML (for graphics) in order to talk to the Arduino via USB-Serial using the program I'm currently making.
I found a video on YouTube, this one. I walked through how to get the external header files and source into place. Easy enough. Then, Visual Studio 2013 gave me some problems but I fixed them and got it working. I could finnaly communicate though C++! Now I just have one problem. In the video and the example code, it only sends one character. As I need full 0-255 RGB, I am required to send 9 chars from the C++ program to the Arduino. An example of what I would be sending is this: '2' '5' '5' '0' '0' '0' '2' '5' '5'. Thats some 2's, some 5's and some 0's, which would make 255 red (full red light), 0 green (no green light) and 255 blue (full blue light), which would make the RGB LED strip light up in a dark purple color.
So 9 chars in total. I've tried doing something like this in the C++ side of things, which would send all 9 items in the colorData array.
for (int i = 0; i < 9; i++){
comm.send_data(colorData[i]);
}
and on the Arduino, this is where I think I have messed up. I'm not really sure how I am going to collect all this serial data. This is what the code looks like
while(Serial.available() > 9){
for(int i=0; i<9; i++)
colorData[i] = Serial.read();
}
which theoretically should read the Serial data one at a time and put that into the colorData array on the Arduino.
Any help would be apprechiated, thanks!