Add OLED library - update tiny wire libraries - add support for all PWM channels and PWM on pin 8

This commit is contained in:
Erik Tylek Kettenburg
2015-01-14 18:08:45 -08:00
parent fb93846380
commit 52f444d221
60 changed files with 3285 additions and 710 deletions

View File

@@ -0,0 +1,37 @@
// SweepNoDelay
// by RC Navy (http://p.loussouarn.free.fr/arduino/arduino.html>)
// This sketch can work with ATtiny and Arduino UNO, MEGA, etc...
// This example code is in the public domain.
#include <SoftRcPulseOut.h>
SoftRcPulseOut myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
#define SERVO_PIN 0
#define UP_DIRECTION +1
#define DOWN_DIRECTION -1
#define POS_MIN 0
#define POS_MAX 180
int pos = POS_MIN; // variable to store the servo position
int step = UP_DIRECTION;
void setup()
{
myservo.attach(SERVO_PIN); // attaches the servo on pin defined by SERVO_PIN to the servo object
myservo.write(pos);
}
void loop()
{
if (SoftRcPulseOut::refresh()) // refresh() returns 1 every 20ms (after pulse update)
{
// We arrive here every 20ms
pos += step;
if(pos >= POS_MAX) step = DOWN_DIRECTION; //180 degrees reached -> Change direction
if(pos <= POS_MIN) step = UP_DIRECTION; // 0 degrees reached -> Change direction
myservo.write(pos);
}
}