We started the projects with the chlalenge of getting our parts a day before our second milestone. Alongside with that, we did not order the right parts for what we believed would work for our project. We ordered 5V laser diodes, instead of the 3.3V that the ESP32 could handle alongside with hardware PWM funcitonality. We believed photoresistors were the way to go, but we quickly found out they vary dramatically as far as what the output voltage will be, even with a laser shining on it.
Halfway thorughout the project, our instructors gave us the appropriate materials we needed to make a funcitoning laser tag game. We received phototransistors and 3.3V laser diodes which allowed for amazing readings with PWM functionality. With the correct hardware in place, it was a shocker to us that continiung on with the project was still difficult. We soon discovered that hardware PWM and having the ESP32 know when a laser is being fired was difficult. We used two pins for our laser gun system, one for the button and the other for the laser diode. This configuration for our laser gun made the hardware PWM not run how we wanted it to, when button is pressed allow for the laser to turn on with PWM. After days of debugging, we were told by our instructors to use the software implementation that we did in lab. Sure enough the software implementation worked, but not well enough for our purposes.
As we tested our code that was going to average the time between Off and On readings from multiple readings, we soon realized that not every shot was going to be perfect. The reason for PWM was to identify between different lasers so we can keep count of which player eliminates who. We tested shooting the phototransistors in a real world situation, so shooting the sensor briefly and from a distance, and the readings were no longer ideal. "No Problem! Let's just higher the PWM frequency." - Derek said. Well since we were using software PWM the laser diode bugged up and stayed on and showed no aspects of operating in PWM, at 10000+ Hz.
Our final problem came from our ESP32. Andrew had previously used RGB light strips on an Arduino and hoped that it would be similiar on the ESP32. Unfortunately, the lights sometimes did not do what they were supposed to and stayed lit up or turned off. The RGB light bar and ESP32 caused extra hours of stress when we knew that it should have worked. We just worked with it as we had some lights stay on as we prorgessed thorughout our project.