Pc and Mcore with bluetooth module are paired. The port is COM9 outgoing in PC. However, when I send message Arduino does not get anything. I just disconnect arduino from pc and write simple code in Mcore that turn on LED when input message is 1. However still nothing. These are the codes in python and arduino side:
import time
import serial
port="COM9" #This will be different for various devices,COM port.
bluetooth=serial.Serial(port, 9600) #Start communications with the bluetooth unit
bluetooth.flushInput() #This gives the bluetooth a little kick
bluetooth.write(b'1') #These need to be bytes not unicode
bluetooth.close() #Otherwise the connection will remain open until a timeout
Arduino code:
char a;
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop()
{
if(Serial.available()){a = Serial.read();}
if (a == '1'){
digitalWrite(13, HIGH);
}
else{
digitalWrite(13, LOW);}
delay(100);
}
I have tried to install Pybluez for WIN10, however, there was error. Do you think that this is the reason?
Thanks in advance
else
part to debug