I just spent a very long time debugging a problem that, had I been looking at someone else's code I would have spotted straight away.
By way of confession...
I have a really nice new board from LILYGO and it has an ESP32-WROVER and 4 relays on it.
Because of an odd way they do the USB programming (a proprietary USB dongle which is included if you buy the "relay set" option) my usual MacOS platform was not working. There is some incompatibility with the chipset that doesn't have a definitive solution yet. So I moved over to the ThinkPad I use when I must use Windows to try it there.
Because the Arduino installation on that machine isn't as fully populated with libraries and my own programs. To simplify¹ things, I decided to upload the blink sketch to check that I could put a binary on the board. The first attempt to upload it resulted in an error. The LED_BUILTIN constant was not defined in the ESP32 DEV core. So, I put in a define, guessing at the pin that seemed to be the LED on the board.
It worked! But, it was not the board's LED flashing but the first relay and its associated LED. That gave me the idea to adapt the script to test all four relays. So I looked up the pins for the 3 others, and added them. But, it just didn't work. The first relay worked but the rest did nothing. I went through all sorts of contortions to try to get it to work, even traced the pins on the hardware and trying those numbers.
Then I changed the LED_BUILTIN define to the pin of the second relay. It worked! I was getting pretty annoyed. That's when it struck me. I had totally forgotten to add in pinMode() statements for the additional pins, so of course it didn't work!
So, I felt like a bonehead. This seemed an appropriate assessment but it got me thinking. If someone else had done the same thing, and said that of themselves, I would have objected knowing very well how blind we can be to things right in front of us when we are focused on something else.
Lately, I have been doing a lot of thinking about practicing self kindness. That is, not beating myself up because I have limitations, or make mistakes of the sort everyone makes. I am not better than other people in a way that I should judge myself more harshly that I would them. If I had been negligent there might be a reason for some self criticism, but I was just being normal.
It is exacerbated in my case because I suffer from ADHD. It has been a lifelong problem and the effects it has on attention and related functions can be very profound. If I have a "bad day", I need to just avoid trying to do anything important because there is a real danger I will make a mistake that I don't spot at all. Fortunately, treatment is very effective and though I waited far too long to do something about it I now have medicine that works very well.
I am willing to bet that a number of people reading this are fellow sufferers²—diagnosed or not—and you will understand what I am talking about. But you don't have to have ADHD to get so focused on a particular aspect of a problem that you don't see what someone uninvolved could spot in seconds.
All of us should practice self kindness because "do to others what you would want done to you", or whichever version of the Golden Rule you prefer, isn't very nice for others if you don't want kindness for yourself. You and I are not boneheads, we are jus people.
1. As I well knew, and didn't pay attention to, a shortcut is rarely a simplification. It's just a way to spend as much—or more—time but feel like you got a head start.
2. Engineering and computer science, and less formal versions of both, are very attractive to people with ADHD because of many of the characteristics of the activities and so we are over-represented in these fields.
By way of confession...
I have a really nice new board from LILYGO and it has an ESP32-WROVER and 4 relays on it.
Because of an odd way they do the USB programming (a proprietary USB dongle which is included if you buy the "relay set" option) my usual MacOS platform was not working. There is some incompatibility with the chipset that doesn't have a definitive solution yet. So I moved over to the ThinkPad I use when I must use Windows to try it there.
Because the Arduino installation on that machine isn't as fully populated with libraries and my own programs. To simplify¹ things, I decided to upload the blink sketch to check that I could put a binary on the board. The first attempt to upload it resulted in an error. The LED_BUILTIN constant was not defined in the ESP32 DEV core. So, I put in a define, guessing at the pin that seemed to be the LED on the board.
It worked! But, it was not the board's LED flashing but the first relay and its associated LED. That gave me the idea to adapt the script to test all four relays. So I looked up the pins for the 3 others, and added them. But, it just didn't work. The first relay worked but the rest did nothing. I went through all sorts of contortions to try to get it to work, even traced the pins on the hardware and trying those numbers.
Then I changed the LED_BUILTIN define to the pin of the second relay. It worked! I was getting pretty annoyed. That's when it struck me. I had totally forgotten to add in pinMode() statements for the additional pins, so of course it didn't work!
So, I felt like a bonehead. This seemed an appropriate assessment but it got me thinking. If someone else had done the same thing, and said that of themselves, I would have objected knowing very well how blind we can be to things right in front of us when we are focused on something else.
Lately, I have been doing a lot of thinking about practicing self kindness. That is, not beating myself up because I have limitations, or make mistakes of the sort everyone makes. I am not better than other people in a way that I should judge myself more harshly that I would them. If I had been negligent there might be a reason for some self criticism, but I was just being normal.
It is exacerbated in my case because I suffer from ADHD. It has been a lifelong problem and the effects it has on attention and related functions can be very profound. If I have a "bad day", I need to just avoid trying to do anything important because there is a real danger I will make a mistake that I don't spot at all. Fortunately, treatment is very effective and though I waited far too long to do something about it I now have medicine that works very well.
I am willing to bet that a number of people reading this are fellow sufferers²—diagnosed or not—and you will understand what I am talking about. But you don't have to have ADHD to get so focused on a particular aspect of a problem that you don't see what someone uninvolved could spot in seconds.
All of us should practice self kindness because "do to others what you would want done to you", or whichever version of the Golden Rule you prefer, isn't very nice for others if you don't want kindness for yourself. You and I are not boneheads, we are jus people.
1. As I well knew, and didn't pay attention to, a shortcut is rarely a simplification. It's just a way to spend as much—or more—time but feel like you got a head start.
2. Engineering and computer science, and less formal versions of both, are very attractive to people with ADHD because of many of the characteristics of the activities and so we are over-represented in these fields.