Hi everyone, this is my first post, i like playing with led's and i am slowly learning about Arduino's but i find it very hard with the programming so i am asking for a little help please.
I have made some garden lights and i want to be able to change between effects with my android phone via Bluetooth, i have found about 5 programs i would like to use as different effects, i can get them to run individually and continuously but i want to integrate them with Bluetooth and be able to select whatever light effect i want.
I have built an android app with app inventor (with the help of "Electronoobs" ) on YouTube and i can turn on individual leds with the app but i have tried in vain to get it to work with my program, i have looked at the program on here where all of the light displays are linked together, https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/.... i think that is the right link and using a button to switch between effects.
At last i thought, i can use a relay to replace the button and switch it with Bluetooth, simple i thought....... hmmmmmmmmmm not so easy, i have tried to comment out the effects i didn't want with // in the code but i keep getting it wrong, also the code is so long it takes seconds for the relay to switch sometimes.
I know you can put interrupts in but i have no idea how to and ware to put them, the code from the Bluetooth is...
int rainbow=7;
int Meteor=8;
int colour t=9;
int white t=10;
int snow=11;
int rainbow_state=0;
int meteor_state =0;
int colour t_state = 0;
int white t_state = 0;
int snow_state = 0;
void setup(){
Serial.begin(9600);
pinMode(rainbow,OUTPUT);
pinMode(meteor,OUTPUT);
pinMode(couour t,OUTPUT);
pinMode(white t,OUTPUT);
pinMode(snow,OUTPUT);
}
void loop(){
if(Serial.available()>0)
{
Received = Serial.read();
}
////////////////rainbow////////////////////
if (rainbow_state == 0 && Received == '1')
{
digitalWrite(rainbow,HIGH);
rainbow_state=1;
Received=0;
}
if (rainbow_state ==1 && Received == '1')
{
digitalWrite(rainbow,LOW);
rainbow_state=0;
Received=0;
}
///////////////////////////////////////////
////////////////meteor/////////////////////
if (meteor_state == 0 && Received == 'a')
{
digitalWrite(meteor,HIGH);
meteor_state=1;
Received=0;
}
if (meteor_state ==1 && Received == 'a')
{
digitalWrite(,meteorLOW);
meteor_state=0;
Received=0;
}
///////////////////////////////////////////
////////////////colour t/////////////////////
if (colour t_state == 0 && Received == '2')
{
digitalWrite(colour t,HIGH);
colour t_state=1;
Received=0;
}
if (colour t_state ==1 && Received == '2')
{
digitalWrite(colour t,LOW);
colour t_state=0;
Received=0;
}
///////////////////////////////////////////
////////////////white t/////////////////////
if (white t_state == 0 && Received == '2')
{
digitalWrite(white t,HIGH);
white t_state=1;
Received=0;
}
if (white t_state ==1 && Received == '2')
{
digitalWrite(white t,LOW);
white t_state=0;
Received=0;
}
///////////////////////////////////////////
////////////////snow/////////////////////
if (snow_state == 0 && Received == '2')
{
digitalWrite(snow,HIGH);
snow_state=1;
Received=0;
}
if (snow_state ==1 && Received == '2')
{
digitalWrite(snowLOW);
snow_state=0;
Received=0;
}
///////////////////////////////////////////
}
I have added some buttons and renamed them but the code works fine with leds and my phone, i am using the "fast led framework" and adding my code in the reliant areas but if someone would be so kind as to show me the code to switch between displays with Bluetooth please i would be so great full.
Regards Martin (led bloke)