Example Code for Arduino-Simulate 60Hz Light Flicker
Last revision 2026/01/16
Burn the codes to another main-controller, and connect an LED to the Digital pin 10 to simulate the light source of 60Hz.
Hardware Preparation
- Main-controller (e.g., DFRduino UNO R3) x 1
- LED x 1
- Wires
Software Preparation
Wiring Diagram
Connect an LED to the Digital pin 10 of the main-controller.
Other Preparation Work
Burn the codes to another main-controller.
Sample Code
//60HZ
//Burn the codes to another main-controller, and connect an LED onto the Digital pin 10 to provide 60Hz ambient light for getFlicker.ino.
void setup() {
pinMode(10, OUTPUT);
}
void loop() {
digitalWrite(10, HIGH); // turn the LED on (HIGH is the voltage level)
delayMicroseconds(4167);
digitalWrite(10, LOW); // turn the LED on (HIGH is the voltage level)
delayMicroseconds(4167);
}
Was this article helpful?
