mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
examples: format all .ino files
This formats all the example source files using Arduino style rules.
This commit is contained in:
committed by
Ivan Grokhotkov
parent
e226251b27
commit
61cd8d8385
@ -1,39 +1,36 @@
|
||||
/* Sweep
|
||||
by BARRAGAN <http://barraganstudio.com>
|
||||
This example code is in the public domain.
|
||||
by BARRAGAN <http://barraganstudio.com>
|
||||
This example code is in the public domain.
|
||||
|
||||
modified 28 May 2015
|
||||
by Michael C. Miller
|
||||
modified 8 Nov 2013
|
||||
by Scott Fitzgerald
|
||||
modified 28 May 2015
|
||||
by Michael C. Miller
|
||||
modified 8 Nov 2013
|
||||
by Scott Fitzgerald
|
||||
|
||||
http://arduino.cc/en/Tutorial/Sweep
|
||||
*/
|
||||
http://arduino.cc/en/Tutorial/Sweep
|
||||
*/
|
||||
|
||||
#include <Servo.h>
|
||||
|
||||
Servo myservo; // create servo object to control a servo
|
||||
// twelve servo objects can be created on most boards
|
||||
|
||||
#include <Servo.h>
|
||||
|
||||
void setup()
|
||||
{
|
||||
myservo.attach(2); // attaches the servo on GIO2 to the servo object
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Servo myservo; // create servo object to control a servo
|
||||
// twelve servo objects can be created on most boards
|
||||
|
||||
|
||||
void setup() {
|
||||
myservo.attach(2); // attaches the servo on GIO2 to the servo object
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int pos;
|
||||
|
||||
for(pos = 0; pos <= 180; pos += 1) // goes from 0 degrees to 180 degrees
|
||||
{ // in steps of 1 degree
|
||||
myservo.write(pos); // tell servo to go to position in variable 'pos'
|
||||
delay(15); // waits 15ms for the servo to reach the position
|
||||
}
|
||||
for(pos = 180; pos>=0; pos-=1) // goes from 180 degrees to 0 degrees
|
||||
{
|
||||
myservo.write(pos); // tell servo to go to position in variable 'pos'
|
||||
delay(15); // waits 15ms for the servo to reach the position
|
||||
}
|
||||
}
|
||||
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
|
||||
// in steps of 1 degree
|
||||
myservo.write(pos); // tell servo to go to position in variable 'pos'
|
||||
delay(15); // waits 15ms for the servo to reach the position
|
||||
}
|
||||
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
|
||||
myservo.write(pos); // tell servo to go to position in variable 'pos'
|
||||
delay(15); // waits 15ms for the servo to reach the position
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user