Arduino Pro Micro (ATMega32u4) with Bluetooth HC-05
only brief test code below, works perfectly.
upon receiving "a", led turned on.
but works if ide arduino open. if closed, or powered circuit can connect through phone, not seem correctly recognize commands.
what doing wrong?
*through @ commands, baud set 38400.
upon receiving "a", led turned on.
but works if ide arduino open. if closed, or powered circuit can connect through phone, not seem correctly recognize commands.
what doing wrong?
*through @ commands, baud set 38400.
code: [select]
char aux = 0;
int led = 17;
void setup() {
serial1.begin(38400);
while (!serial1);
pinmode(led, output);
digitalwrite(led, high);
}
void loop() {
if (serial1.available()) {
aux = (char) serial1.read();
delay(100);
if (aux == 'a') {
digitalwrite(led, low);
} else {
digitalwrite(led, high);
}
}
delay(100);
}
Arduino Forum > Using Arduino > Programming Questions > Arduino Pro Micro (ATMega32u4) with Bluetooth HC-05
arduino
Comments
Post a Comment