Hi everyone,
I've made with succes a BT remote and reveiver to drive 120A ESC.
The emitter is made of a ATMEGA8A (internal 8MHZ), a HC- board and 4 HAL effect sensors (it will be driven by a magnet in a waterproof case).
The receiver drives a PWM output and receive by BT the level (7 differents states).
Everything works very well. I've checked the signal with a scope and the signals are very precise (from 1ms to 2 ms max.)
I want to securise the working by adding a BT connection check because, when i drive to the maximum (2ms) and unplug the remote supply, the receiver is locked on 2ms.
That means, when i will fall of my surf, it will continue untill there is no more battery. Good luck for me, i'm quite a good swimmer .
It's because the receiver always check the USART reception and gets locked on :
while (!(UCSRA & (1 << RXC))); /* Wait until new data receive */
So, when the connection is lost, it waits for a byte that never comes.
Does someone knows how to make it safe ?
Thank you