Skip to content

Commit bec6bcf

Browse files
committed
Updates to a number of Examples
removed pachube examples, added xively examples. changes to the Servo examples
1 parent 236be58 commit bec6bcf

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

examples/Knob/Knob.ino

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
// Controlling a servo position using a potentiometer (variable resistor)
2-
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
1+
/*
2+
Controlling a servo position using a potentiometer (variable resistor)
3+
by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
4+
5+
modified on 8 Nov 2013
6+
by Scott Fitzgerald
7+
http://arduino.cc/en/Tutorial/Knob
8+
*/
39

410
#include <Servo.h>
511

@@ -16,7 +22,7 @@ void setup()
1622
void loop()
1723
{
1824
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
19-
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
25+
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
2026
myservo.write(val); // sets the servo position according to the scaled value
2127
delay(15); // waits for the servo to get there
2228
}

examples/Sweep/Sweep.ino

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
// Sweep
2-
// by BARRAGAN <http://barraganstudio.com>
3-
// This example code is in the public domain.
1+
/* Sweep
2+
by BARRAGAN <http://barraganstudio.com>
3+
This example code is in the public domain.
44
5+
modified 8 Nov 2013
6+
by Scott Fitzgerald
7+
http://arduino.cc/en/Tutorial/Sweep
8+
*/
59

610
#include <Servo.h>
711

812
Servo myservo; // create servo object to control a servo
9-
// a maximum of eight servo objects can be created
13+
// twelve servo objects can be created on most boards
1014

1115
int pos = 0; // variable to store the servo position
1216

@@ -15,15 +19,14 @@ void setup()
1519
myservo.attach(9); // attaches the servo on pin 9 to the servo object
1620
}
1721

18-
1922
void loop()
2023
{
21-
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
24+
for(pos = 0; pos <= 180; pos += 1) // goes from 0 degrees to 180 degrees
2225
{ // in steps of 1 degree
2326
myservo.write(pos); // tell servo to go to position in variable 'pos'
2427
delay(15); // waits 15ms for the servo to reach the position
2528
}
26-
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
29+
for(pos = 180; pos>=0; pos-=1) // goes from 180 degrees to 0 degrees
2730
{
2831
myservo.write(pos); // tell servo to go to position in variable 'pos'
2932
delay(15); // waits 15ms for the servo to reach the position

0 commit comments

Comments
 (0)