The Arduino BT Communication is an application to able you test your Arduino BT Board with Ardroid devices using Bluetooth communication.
With Arduino BT Communication you are able to test each pin available in your board; you have an screen with al input pins as progress bars to see its values and output pins as toggle buttons and seek bar to turn off and turn on pins.
Examples of sensors of actuators you can attach to your board:
1. LEDS
2. Relays for high power phases
3. Measure temperature
4. Measure light
We hope you find plenty of hours of fun with your Arduino BT Board
This is the code you need to upload to your Arduino BT board in order to play with the Android application:
char strEntrada[14]={'H','H','H','H','H','H',1,1,1,1,1,1,'r','n'};
char strSalida[27]={-1,-2,-3,'1','1','1','1','1','1',-4,-5,-6,'l','l','l','l','l','l','l','l','l','l','l','l',-3,-2,-1};
void setup()
{
Serial.begin(115200);
//Salidas digitales
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
//pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
//Salidas PWD
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
analogReference(DEFAULT);
}
void loop()
{
strSalida[3]=analogRead(A0)/8;
strSalida[4]=analogRead(A1)/8;
strSalida[5]=analogRead(A2)/8;
strSalida[6]=analogRead(A3)/8;
strSalida[7]=analogRead(A4)/8;
strSalida[8]=analogRead(A5)/8;
for (int indice=0;indice<11;indice++)
{
strSalida[12+indice]=strEntrada[indice];
}
if( Serial.available()>=11)
{
for(int i=0; i < 12; i++)
{
strEntrada[i] = Serial.read();
}
for (int indice=0;indice<11;indice++)
{
strSalida[12+indice]=strEntrada[indice];
}
Serial.println(strSalida+' ');
Serial.flush();
}
if( strEntrada[0] == 'H' ) {digitalWrite(2, HIGH); } else { digitalWrite(2, LOW);}
if( strEntrada[1] == 'H' ) {digitalWrite(4, HIGH); } else { digitalWrite(4, LOW);}
if( strEntrada[3] == 'H' ) {digitalWrite(8, HIGH); } else { digitalWrite(8, LOW);}
if( strEntrada[4] == 'H' ) {digitalWrite(12, HIGH); } else { digitalWrite(12, LOW);}
if( strEntrada[5] == 'H' ) {digitalWrite(13, HIGH); } else { digitalWrite(13, LOW);}
analogWrite(3, interpretarEntrada(strEntrada[6]));
analogWrite(5, interpretarEntrada(strEntrada[7]));
analogWrite(6, interpretarEntrada(strEntrada[8]));
analogWrite(9, interpretarEntrada(strEntrada[9]));
analogWrite(10, interpretarEntrada(strEntrada[10]));
analogWrite(11, interpretarEntrada(strEntrada[11]));
delay(10);
}
int interpretarEntrada(char caracterEntrada)
{
int resultado=0;
resultado=caracterEntrada*2;
return resultado;
}