/usr/share/fritzing/sketches/core/Fritzing Creator Kit DE+EN/creator-kit-en/Fritzing Creator Kit/Motor/Motor.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 27 28 29 30 31 32 33 34 35 36 37 38 39 | /*
Motor
turning a motor clock then counter clock wise
This example is part of the Fritzing Creator Kit: www.fritzing.org/creatorkit.
*/
int motor_A=6; // motor A Pin
int motor_B=5; // motor B Pin
int motor_Speed=3; // speed Pin
void setup(){
pinMode(motor_A,OUTPUT); // pin A declared as OUTPUT
pinMode(motor_B,OUTPUT); // pin B declared as OUTPUT
}
void loop(){
digitalWrite(motor_A,HIGH); // motor A pin switched to HIGH (+5V)
digitalWrite(motor_B,LOW); // motor B pin switched to LOW (GND)
for (int i=0; i<256; i+=5){ // count up to 255 in steps of five
analogWrite(motor_Speed,i); // and write it as speed to the speed pin
delay(20); // wait 20 ms
}
for (int i=255; i>0; i-=5){ // count down from 255 to 0 by 5
analogWrite(motor_Speed,i); // and write it as speed to the speed pin
delay(20); // wait 20 ms
}
digitalWrite(motor_A,LOW); // motor A pin switched to HIGH (GND)
digitalWrite(motor_B,HIGH); // motor B pin switched to LOW (+5V)
for (int i=0; i<256; i+=5){ // count up to 255 in steps of five
analogWrite(motor_Speed,i); // and write it as speed to the speed pin
delay(20); // wait 20 ms
}
for (int i=255; i>0; i-=5){ // count down from 255 to 0 by 5
analogWrite(motor_Speed,i); // and write it as speed to the speed pin
delay(20); // wait 20 ms
}
}
|