Flashing Light Prize (1) Arduino Wave Generator


1. Arduino Uno
2. Micro Servo
3. 5V Regulator
4. (2) 10nf Cap
5. 12V Incandescent Bulb
6. Acrylic (Dollar Store Picture Frame)
7. 10K Potentiometer (Optional)
8. Table Salt or Baking Soda


  1. // Flashing Light Prize (1)
  2. // pkvi
  3. #include <Servo.h>
  4. Servo wave;
  5. // Pot Analog Pin 0
  6. int pot = A0;
  7. // Delay Value
  8. int val = 0;
  9. // Servo Positions
  10. int fro = 0;
  11. int bac = 160;
  12. int pos = 0;
  13. void setup() {
  14. Serial.begin(9600);
  15. wave.attach(5);
  16. wave.write(pos);
  17. }
  18. void loop() {
  19. // Read Potentiometer
  20. val = analogRead(pot);
  21. // Print Value
  22. Serial.println(val);
  23. // Map Pot to Delay Value
  24. val = map(val, 0, 1023, 0, 20);
  25. // Print Value
  26. Serial.println(val);
  27. // Back
  28. for (pos = fro; pos <= bac; pos += 1)
  29. {
  30. wave.write(pos);
  31. delay(val);
  32. }
  33. // Forward
  34. for (pos = bac; pos >= fro; pos -= 1)
  35. {
  36. wave.write(pos);
  37. delay(val);
  38. }
  39. }

Menu
Index
Engineering
Entertainment
Literature
Miscellaneous
Contact
Search
tiktok.com/@pkvi.xyz
Why Ayh?
Miter
Miter
@pkvi
"...may not meet professional standards."
2,364 miters
123 tenons
Subscribe
0.00348