-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
46,824 additions
and
46,334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
Controlling a servo position using a potentiometer (variable resistor) | ||
by Michal Rinott <http://people.interaction-ivrea.it/m.rinott> | ||
modified on 8 Nov 2013 | ||
by Scott Fitzgerald | ||
http://www.arduino.cc/en/Tutorial/Knob | ||
*/ | ||
|
||
#include <Servo.h> | ||
|
||
Servo myservo; // create servo object to control a servo | ||
|
||
int potpin = 0; // analog pin used to connect the potentiometer | ||
int pin = PA15; | ||
int val; // variable to read the value from the analog pin | ||
|
||
void setup() { | ||
myservo.attach(pin); // attaches the servo on pin 9 to the servo object | ||
} | ||
|
||
void loop() { | ||
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) | ||
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) | ||
myservo.write(val); // sets the servo position according to the scaled value | ||
delay(15); // waits for the servo to get there | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* Sweep | ||
by BARRAGAN <http://barraganstudio.com> | ||
This example code is in the public domain. | ||
modified 8 Nov 2013 | ||
by Scott Fitzgerald | ||
http://www.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 | ||
|
||
int pos = 0; // variable to store the servo position | ||
int pin = PA15; | ||
|
||
void setup() { | ||
myservo.attach(pin); // attaches the servo on pin 9 to the servo object | ||
} | ||
|
||
void loop() { | ||
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 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/**************************************************************************/ | ||
/*! | ||
@file delay.h | ||
@author hathach | ||
@section LICENSE | ||
Software License Agreement (BSD License) | ||
Copyright (c) 2016, Adafruit Industries (adafruit.com) | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holders nor the | ||
names of its contributors may be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY | ||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY | ||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
/**************************************************************************/ | ||
|
||
#ifndef _UTIL_DELAY_H_ | ||
#define _UTIL_DELAY_H_ | ||
|
||
// This file exist for Arduino AVR comaptible compilation only | ||
#include "../delay.h" | ||
|
||
#endif /* _UTIL_DELAY_H_ */ |
Oops, something went wrong.