Thx santos - I am glad I could help
Here is the new video ->
It's really basic
the arduino sketch is here:
// pins for the LEDs:
const int redPin = 9;
const int greenPin = 10;
const int bluePin = 11;
void setup() {
// initialize serial:
Serial.begin(19200);
// make the pins outputs:
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
Serial.setTimeout(50);
}
void loop() {
// if there's any serial available, read it:
while (Serial.available() > 0) {
// look for the next valid integer in the incoming serial stream:
int red = Serial.parseInt();
// do it again:
int green = Serial.parseInt();
// do it again:
int blue = Serial.parseInt();
// look for the newline. That's the end of your
// sentence:
if (Serial.read() == '\n') {
// constrain the values to 0 - 255 and invert
// if you're using a common-cathode LED, just use "constrain(color, 0, 255);"
red = 255 - constrain(red, 0, 255);
green = 255 - constrain(green, 0, 255);
blue = 255 - constrain(blue, 0, 255);
// fade the red, green, and blue legs of the LED:
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}
}
}
Obviously you might have to change baud rate if your module uses different
rgb_1.apk is the app
rgb_1.zip is a source file for use with app inventor (to upload the source it into app inventor you have to click on more actions button right next to to new button you use to create new projects - there is an option upload source. Just select it an upload the file)
Wiring is almost exactly the same as in here -> http://arduino.cc/en/Tutorial/ReadASCIIString
but I used pins 9,10 and 11 instead of 3,5 and 6.
NOTICE
If you're not logged in as a member here you can't see the attachments so you can't download them. I just realized this problem. So if for the aforementioned reason you can't see the files just try this link instead ->>
https://drive.google.com/folderview?id=0B_PfPoEotOF8N2JwT3RSX011SjQ&usp=sharing
rgb_1.apk (1.26 MB)
rgb_1.zip (3.82 KB)