thanks!
Actually I made my app work 2 days ago before I saw your answer . I don't know why I didn't figured out that before it was pretty easy bug to fix ...
thanks for your help (yeah that was my mistake: " the problem was that your app was sending bytes and arduino was expecting integers")
I'll add a new example app soon - I still have to film it. Support for sliders has recently been added so I just want to show you how to use them to control RGB lights (and how to send several values using send string and parse int on arduino side)
ohh and if you have any suggestions or ideas for apps feel free to post them - I am running out of ideas
kerimil:
I'll add a new example app soon - I still have to film it. Support for sliders has recently been added so I just want to show you how to use them to control RGB lights (and how to send several values using send string and parse int on arduino side)
ohh and if you have any suggestions or ideas for apps feel free to post them - I am running out of ideas
// 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)
Hi!!..thanks for this application...whenever I connect my android phone to bluetooth device to arduino uno it shows a runtime error :
Need bluetooth _admin permission :neither user 10116 nor current proces has android.permission.BLUETOOTH_ADMIN...please help..
I am using HC-06 bluetooth module. It gets paired normally but not using this application....
Please help!!
kevindomadia:
Hi!!..thanks for this application...whenever I connect my android phone to bluetooth device to arduino uno it shows a runtime error :
Need bluetooth _admin permission :neither user 10116 nor current proces has android.permission.BLUETOOTH_ADMIN...please help..
I am using HC-06 bluetooth module. It gets paired normally but not using this application....
Please help!!
AFAIK that's problem with your device. Apparently for some reason bluetooth SPP is blocked on it. Probably rooting the phone might help but I never tested that. Other people who reported the same problem just used a different device
New update coming soon. This time a major one - I decided to switch to ethernet rather than a bluetooth communication. There are a couple of reasons for that...
First of all, I found a cheap ethernet module (ENC28j60) that's roughly $6 a piece and a good library for it (not the standard one) - that's more less as cheap as the cheapest bluetooth modules.
Secondly, it eliminates the need to have a separate android device to serve as a relay between arduinos and the internet - that gets annoying when you want to have a remote temperature sensor at home.
What's more, I think it will be easier to understand and troubleshoot than bluetooth communication since everything is more transparent (some ppl just couldn't understand that it's good to see what's being sent).
Finally, it allows to use all the different devices to access arduino (not just android devices, but computers and apple/ windows phone devices as well.... though that's through a browser not an app created with MIT's app inventor, but it's nice to have that option)
Not sure if I post it here or in a separate thread - probably in a seperate one because I am afraid it will get confusing after a couple of pages and ppl might fail to notice that there are completely two different methods.
Just use the previous version. Upload it there and see how it works, you can replicate it in appinventor2 in a few minutes once you understand what's needed.
Also as far as I know Appinventor 2 doesn't have any new features yet and its GUI is almost identical
Hi,
I work on similar project. I would like controlling lamps by RF emitter via android app/bluetooth.
I have found sketch "HE300 Automatic Protocol Transmitter 'Simulator' " for replace my chacon remote on Homeeasy page: http://playground.arduino.cc/Code/HomeEasy
The frame is composed of 32 bits (ON / OFF)
it's works great.
Now I would like send frame by android app like you.
In your case, you make pin on high or low but how I can send the chacon frame composed of 32 bits?
Hi Kerimil,
I've tried to load your file, but seems impossible the current App inventor release do not support .zip file format, only suffix .aia format is supported, and the blocks code are not compatible.
No, I don't.
My advice ?? open the old file using the old version of app inventor, see what blocks are used and what they do and then replicate it in the new version
Hi Kerimil! Your project is wonderful but since you look for new ideas how about mixing your circuits and make one program that can control, let's say 9 different lamps, with indicators ON/OFF and when you switch one you can dim it!
Hello my friends. Firstly i want to say thenks for the code because it helped with a handy project.
The problem is that the same code that i use with the arduino duemilanove it doesnt work with attiny 85... the code is very simple.
here is the code for attiny85
when i connect the app is freazing as you see i try to send contineus data from arduino to phone. Do you think that i must find another way to communicate?
Thanks!
Edit: It seems that the serial with the attiny85 doesn't working properly. I always take chinese characters. I dont know why i burned the bootloader without any errors the blink example is working but the serial no...