Hi All
I havent touch arduino for ages but im back at it again, giving me problems , i got two arduinos, got 64 inputs on one arduino so my data to send will be from 1 to 64 bytes?, and then 64 outputs on the other arduino, anyway im just on breadboard now testing the hc 05 module when i serial write a 1 the other arduino takes about 2 seconds to respond, ive never really work with serial or bluetooth so not sure what the right way is to code it?
Please any help?
Thanks
int state = 0;
const int ledPin = 6;
const int buttonPin = 13;
int buttonState = 1;
void setup()
{
Serial.begin(115200);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);
}
void loop()
{
buttonState = digitalRead(buttonPin);
if (buttonState == LOW)
{
Serial.write('1');
digitalWrite(ledPin, HIGH);
}
else
{
Serial.write('0');
digitalWrite(ledPin, LOW);
}
delay(10);
}
``
int incomingByte = 0; // for incoming serial data
const int led = 4;
void setup() {
Serial.begin(115200); // opens serial port, sets data rate to 9600 bps
pinMode(led, OUTPUT);
digitalWrite(led, LOW);
}
void loop() {
// reply only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
}
//Serial.print(incomingByte);
if (incomingByte == '1')
{
digitalWrite(led, HIGH); // LED ON
}
else if (incomingByte == '0')
{
digitalWrite(led, LOW); // LED ON
}
delay(10);
}