hello guys !
i need to control leds and servomotors with an android app using 74hc595 and arduino board . but i can't connect my bluetooth module with the 74hc595 , i need help please and thanks .
this is the code i tried for one led .
#include<SoftwareSerial.h>
int DS_pin = 8;
int STCP_pin = 9;
int SHCP_pin = 10;
int blueTx=0;
int blueRx=1;
SoftwareSerial bluetooth(blueTx,blueRx);
boolean registre[8];
void setup()
{
//configure les broches en sortie
pinMode(DS_pin,OUTPUT);
pinMode(STCP_pin,OUTPUT);
pinMode(SHCP_pin,OUTPUT);
bluetooth.begin(9600);
Serial.begin(9600);
}
void EcrireRegistre()
{
digitalWrite(STCP_pin, LOW);
for (int i = 7; i>=0; i--)
{
digitalWrite(SHCP_pin, LOW);
digitalWrite(DS_pin, registre[i] );
digitalWrite(SHCP_pin, HIGH);
}
digitalWrite(STCP_pin, HIGH);
}
void loop()
{
if (bluetooth.available()>=0){
char value1=Serial.read();
switch (value1){
case 'o': registre[3]=HIGH;break;
case 'p': registre[3]=LOW ;break;
}
}
EcrireRegistre();
}