Fox flasher MkII described a LED driver for an animal deterrent using a Chinese 8051 architecture microcontroller, the STC15F104E.
Above, the schematic. A very simple circuit with just a handful of electronic components (one capacitor, two resistors, one LDR, one Polyswitch, 4 x LEDs and the MCU).
The code has been extended to run also on a STC15F204EA which allows flasher output on 8 pins (P1.0-P1.7, pins 3-10). The LDR is still on P3.2 (17).
Key operating parameters are held in EEPROM, only the EEPROM image needs to be changed to alter the flashing program.
Above, v1 EEPROM format. The first byte is the EEPROM version, next an options byte (reserved), mask byte applied to the output port to permit only certain output port pins to be controlled by the flasher, then highlighted, a count of patterns to follow, and 1-16 pattern bytes that will be randomly selected by the flasher. The bits of the pattern bytes correspond to output port pins, 1 to light the LED. The example file has pattern bytes to light LEDs on pins Px.0,Px.1,Px.4,Px.5.
Above, the ISP program screen showing critical settings.
The hex files and example EEPROM binary files are available for download: FoxFlasher2.