/usr/share/fritzing/sketches/core/Fritzing Creator Kit DE+EN/creator-kit-en/Fritzing Creator Kit/FlipFlop/FlipFlop.ino is in fritzing-data 0.9.3b+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /*
Flip Flop
switching between two LEDs using a button
This example is part of the Fritzing Creator Kit: www.fritzing.org/creator-kit.
*/
int buttonPin=2; // Pin where the button is attached
int greenLED=9; // Pin where the green LED is attached
int redLED=10; // Pin where the red LED is attached
void setup(){
pinMode(buttonPin, INPUT); // button is initialised as INPUT
pinMode(greenLED, OUTPUT); // green LED pin is initialised as OUTPUT
pinMode(redLED, OUTPUT); // red LED pin is initialised as OUTPUT
}
void loop(){
if (digitalRead(buttonPin)==LOW){ // if the button is pressed (LOW)
digitalWrite(greenLED, HIGH); // switch on green LED
digitalWrite(redLED, LOW); // switch off red LED
} else { // else (if button is not pressed)
digitalWrite(greenLED, LOW); // switch off green LED
digitalWrite(redLED, HIGH); // switch on red LED
}
}
|