/usr/share/fritzing/sketches/core/Fritzing Creator Kit DE+EN/creator-kit-en/Fritzing Creator Kit/Servo/Servo.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 | /*
Servo
a potentiometer controls the position of a servo
This example is part of the Fritzing Creator Kit: www.fritzing.org/creator-kit.
*/
#include <Servo.h> // include the library Servo.h
Servo myservo; // creates a servo object
int potpin = 0 ; // potentiometer pin declaration
int val; // val stores the position of the potentiometer
void setup()
{
myservo.attach(9); // connects a servo object to pin 9
}
void loop()
{
val = analogRead(potpin); // potentiometer value is read out
val = map(val, 0, 1023, 0, 179); // and mapped to the range 0 to 179
myservo.write(val); // turning the servo to the angle in val
delay(15); // give the servo time to react
}
|