the base code I have been given makes an LED get brighter through PWM as an object is brought closer to the HC-SRO4 sensor. I have been tasked with adding an interrupt switch so that the LED can be turned OFF and ON while also operating a PWM on the LED when the sensor picks up an object within its range. how do i do this?
Welcome to the forum
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum
Please post your full sketch using code tags when you do
My guess would be that you have mismatched pairs of braces in the sketch but it is impossible to tell without seeing the full sketch
The error message says that the compiler thinks that the error is in line 80. You need to look around there, but the actual error could be anywhere. So we need to see all of the code.
If you want help, please heed the advice of @UKHeliBob and post the code properly.
The circled line is incorrect and there are mismatched braces. Can't help you much without the actual sketch.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.