OK, I solved the problem, it was not my code, but the drivers. I installed the BlueSoleil drivers and it worked