I have succeeded in sending a signal from my phone to the Trinket over Bluetooth, but I have not been able to send a signal from the Trinket to my phone. When I try to Serial.write(), the signal is successfully transmitted to the serial monitor, but is not transmitted via the HC-05. The apps I have tried for receiving the signal are "Bluetooth Terminal" and "ArduTooth", which worked for sending the signal. Is there another library I should use? Below is a simplified version of my code.
Code: Select all
#define SWITCH_PIN 2
int pin_value = LOW;
int old_pin_value = LOW;
void setup() {
pinMode(SWITCH_PIN, INPUT);
Serial.begin(9600);
}
void loop() {
pin_value = digitalRead(SWITCH_PIN);
delay(100);
// If switch flips on, write "a"
if (pin_value == HIGH && old_pin_value == LOW){
Serial.write("a");
}
// If switch flips off, write "b"
else if (pin_value == LOW && old_pin_value == HIGH){
Serial.write("b");
}
old_pin_value = pin_value;
}