// // tri-color LED *common cathode* // int ledpin1 = 2; // red LED connected to pin 2 via 1K ohm resistor int ledpin2 = 3; // blue LED connected to pin 3 via 1K ohm resistor int ledpin3 = 4; // green LED connected to pin 4 via 1K ohm resistor // LED cathode connected to ground void setup() { // nothing for setup } void loop() { //+++++++++ // turn on and off red LED //+++++++++ analogWrite(ledpin1, 255); // turn on the voltage on pin 2 to 5 volts delay(500); // wait for 500 milli seconds analogWrite(ledpin1, 0); // turn off the voltage on pin 2 to 0 volts delay(500); // wait for 500 milli seconds //+++++++++ // turn on and off blue LED //+++++++++ analogWrite(ledpin2, 255); // turn on the voltage on pin 3 to 5 volts delay(500); // wait for 500 milli seconds analogWrite(ledpin2, 0); // turn off the voltage on pin 3 to 0 volts delay(500); // wait for 500 milli seconds //+++++++++ // turn on and off green LED //+++++++++ analogWrite(ledpin3, 255); // turn on the voltage on pin 4 to 5 volts delay(500); // wait for 500 milli seconds analogWrite(ledpin3, 0); // turn off the voltage on pin 4 to 0 volts delay(500); // wait for 500 milli seconds }