Using Hardware Serial with the HC-05 Bluetooth Module

I recently ran into an interesting issue developing my dawn simulator lamp (full project details coming soon): the HC-05 module I was going to use really didn’t play nice with the hardware UART peripheral on the Arduino Nano. Why not use software serial like the countless other tutorials on the HC-05 on the Internet suggest, you may ask. Well, its because this project uses WS2812B LEDs, which are a real pain when you have to do multiple things that require precise timing (both RS232 and the WS2812B’s communication protocol are asynchronous) on something like an Arduino Nano, which isn’t particularly fast, has limited peripherals, doesn’t have a DMA… you get the idea....

September 30, 2020 · 3 min · Infinus

How to Serial.read() Multiple Bytes on Arduino

Have you ever tried to Serial.read() multiple bytes successively with an Arduino, only to have it spit out a bunch of 0xFF or similar nonsense? I sure have. Check out this section of code from my mood light project: uint8_t cmd = Serial.read(); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 //other stuff here else if (cmd == 0xcc) { //set color currR = Serial....

September 30, 2020 · 2 min · Infinus