/* TVSimulator Based on sourcecode from Fade This example simulates a TV screen and behaves like a real TV to make people think you're at home and prevent them from breaking into you flat or house. It uses several random functions and make use of the analogWrite() function. The analogWrite() function uses PWM, so if you want to change the pin you're using, be sure to use another PWM capable pin. On most Arduino, the PWM pins are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11. This example code is in the public domain. See http://www.dipl-ing-kessler.de */ #define RED 9 #define GREEN 10 #define BLUE 11 int brightness = 0; // how bright the LED is int fadeAmount = 5; // how many points to fade the LED by int waitloop; // the setup routine runs once when you press reset: void setup() { // declare output: pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); } // the loop routine runs over and over again forever: void loop() { // set the brightness: analogWrite(RED, random(0,255)); analogWrite(GREEN, random(0,200)); // Green LED too dominant analogWrite(BLUE, random(0,255)); // wait for 30 milliseconds to see the dimming effect waitloop=random(20,120); if(waitloop>117) waitloop=1000; delay(waitloop); }