colinodowd
Member
- Joined
- Jan 23, 2020
- Messages
- 12
- Programming Experience
- 1-3
I am attempting to send data from a C# GUI to the Teensy 3.2 via the Bluetooth port on my PC but am having no luck. The data transfer is working in the opposite direction (sending data from Arduino to C# GUI). I am using the Bluetooth port on Putty to try to see the "test string" but am getting no results. I am, however, getting a constant string of -1s.
Teensy code:
C# code (I am basically just sending a test string on repeat):
My Tx from HC-05 to Rx on Teensy and Rx from HC-05 to Tx on Teensy. I believe all of my wiring is correct because I am receiving data from all my Teensy sensors to my C# GUI through a Bluetooth COM port. However, when I try to send something to the Teensy and read it through Serial1.Read() I just get -1s.
I believe I am missing something on the outgoing connection from my PC to Teensy
.
Teensy code:
C#:
#define HWSERIAL Serial1
void setup() {
HWSERIAL.begin(9600);
}
void loop() {
String command = HWSERIAL.read();
HWSERIAL.print(command);
HWSERIAL.println();
}
C# code (I am basically just sending a test string on repeat):
C#:
private void button11_Click(object sender, EventArgs e)
{
portBTSend = new SerialPort("COM24", 9600, Parity.None, 8, StopBits.One);
portBTSend.RtsEnable = true;
portBTSend.DtrEnable = true;
try
{
portBTSend.Open();
}
catch (Exception e1)
{
label8.Text = "Connection to BT Failed. Try Again";
}
while (true) {
portBTSend.Write("TEST STRING");
System.Threading.Thread.Sleep(1000);
}
}
My Tx from HC-05 to Rx on Teensy and Rx from HC-05 to Tx on Teensy. I believe all of my wiring is correct because I am receiving data from all my Teensy sensors to my C# GUI through a Bluetooth COM port. However, when I try to send something to the Teensy and read it through Serial1.Read() I just get -1s.
I believe I am missing something on the outgoing connection from my PC to Teensy
.