Usually the issue with this is how precise the timing has to be and how quick it has to be.
You won’t be able to do it with the official features if the time between changes is less than one minute.
You might still be able to do it with webcore even if you need changes that are only a few seconds apart. You will certainly be able to create a “piston“ (which is what Webcore calls their automations), it’s just a question of whether it actually executes with enough precision for your switch to accept it. But there are a number of community members who have done something similar.
If you don’t have a technical background, webcore can look a little confusing at first, but there are many people using it and lots of them will be glad to help you. They even have their own forum.
Here’s the community FAQ about Webcore. (The topic title is a clickable link) That post also has a link to their forum.
You might be able to use the SmartThings SmartApp called ‘The Flasher’ that’s available in the IDE from template. However, the flashing starts and ends with whatever state the light switch is in. So, you’d have to have the switch on when you start the flashing so it ends the flashing with the light switch on.
Like setting up an Automation that when the light switch is turned on, then turn on a virtual switch. The virtual switch would be the trigger for the Flasher SmartApp that would turn off/on the light switch multiple times.
But as #JDRoberts advised, getting the precise timing to work might not be possible. But, The Flasher uses milliseconds so you’d need to do the math to achieve the off/on timing for the light switch.