hi all im new to the arduino forums and i need some help
i have 2 hc05 modules and ive paired them one as a master one as a slave and linked the addresses im receiving on the master side integer numbers in the Serial window these numbers represent an analog input controlled by potentiometer from the slave arduino
check attachment if needed:).
so im sending the analog numbers wirelessly to the master which then displays those numbers.
great so far
but my problem is what i want to do is control pwm on the master with what i do on the slave as i turn the potentiometer on the slave i want led to increase and decrease in brightness wirelessly
on the master.
eventually il be controlling a servo over bluetooth or thats the aim anyway
any ideas? or advice could be greatly appreciated many thanks.
here is my code ;
master arduino >>> my problem
#include <SoftwareSerial.h>// import the serial library
SoftwareSerial Genotronex(7, 8); // RX, TX
int ledpin=13;
int BluetoothData;
int bytee;
void setup() {
Serial.begin(9600);
Genotronex.begin(9600);
pinMode(ledpin,OUTPUT);
pinMode(12,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (Genotronex.available()>0){
bytee=Genotronex.read();
Serial.write(bytee);
}
i got this far and couldnt think of what to do
}
my code for the slave :
#include <SoftwareSerial.h>// import the serial library
SoftwareSerial Genotronex(7, 8); // RX, TX
int BluetoothData;
void setup() {
Genotronex.begin(9600);
pinMode(13,OUTPUT);
pinMode(A0,INPUT);
}
void loop() {
int var=analogRead(A0);
int vare=map(var,0,1023,0,255);
Genotronex.println(vare);
analogWrite(13,vare);
delay(1000);
}
many thanks to anyone who can help if you need more info please let know and hope someone can help