aufgaben weil vergesen zu commiten
This commit is contained in:
@@ -3,16 +3,16 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Constants.h"
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
const uint8_t device_address = 0x40;
|
||||
const size_t output_enable_pin = 2;
|
||||
const PCA9685::DeviceAddress device_address = 0x40;
|
||||
const PCA9685::Pin output_enable_pin = 2;
|
||||
|
||||
const size_t loop_delay = 100;
|
||||
const uint16_t frequency_increment = 10;
|
||||
const PCA9685::Frequency frequency_increment = 10;
|
||||
}
|
||||
|
||||
@@ -3,19 +3,20 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
#include <Arduino.h>
|
||||
#include <PCA9685.h>
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
extern const uint8_t device_address;
|
||||
extern const size_t output_enable_pin;
|
||||
extern const PCA9685::DeviceAddress device_address;
|
||||
extern const PCA9685::Pin output_enable_pin;
|
||||
|
||||
extern const size_t loop_delay;
|
||||
extern const uint16_t frequency_increment;
|
||||
extern const PCA9685::Frequency frequency_increment;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
PCA9685 pca9685;
|
||||
|
||||
uint16_t frequency_min;
|
||||
uint16_t frequency_max;
|
||||
uint16_t frequency;
|
||||
PCA9685::Frequency frequency_min;
|
||||
PCA9685::Frequency frequency_max;
|
||||
PCA9685::Frequency frequency;
|
||||
|
||||
void setup()
|
||||
{
|
||||
@@ -19,8 +19,8 @@ void setup()
|
||||
|
||||
pca9685.setOutputsNotInverted();
|
||||
|
||||
uint16_t time_min = pca9685.getTimeMin();
|
||||
uint16_t time_max = pca9685.getTimeMax();
|
||||
PCA9685::Time time_min = pca9685.getTimeMin();
|
||||
PCA9685::Time time_max = pca9685.getTimeMax();
|
||||
pca9685.setAllChannelsOnAndOffTime(time_min,time_max/4);
|
||||
|
||||
frequency_min = pca9685.getFrequencyMin();
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Constants.h"
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
const uint8_t device_address = 0x40;
|
||||
const size_t output_enable_pin = 2;
|
||||
const PCA9685::DeviceAddress device_address = 0x40;
|
||||
const PCA9685::Pin output_enable_pin = 2;
|
||||
|
||||
const size_t loop_delay = 100;
|
||||
const uint16_t frequency = 200;
|
||||
const uint16_t time_increment = 100;
|
||||
const PCA9685::Frequency frequency = 200;
|
||||
const PCA9685::Time time_increment = 100;
|
||||
|
||||
const uint8_t channel = 0;
|
||||
const PCA9685::Channel channel = 0;
|
||||
}
|
||||
|
||||
@@ -3,22 +3,23 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
#include <Arduino.h>
|
||||
#include <PCA9685.h>
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
extern const uint8_t device_address;
|
||||
extern const size_t output_enable_pin;
|
||||
extern const PCA9685::DeviceAddress device_address;
|
||||
extern const PCA9685::Pin output_enable_pin;
|
||||
|
||||
extern const size_t loop_delay;
|
||||
extern const uint16_t frequency;
|
||||
extern const uint16_t time_increment;
|
||||
extern const PCA9685::Frequency frequency;
|
||||
extern const PCA9685::Time time_increment;
|
||||
|
||||
extern const uint8_t channel;
|
||||
extern const PCA9685::Channel channel;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
PCA9685 pca9685;
|
||||
|
||||
uint16_t time_min;
|
||||
uint16_t time_max;
|
||||
uint16_t off_time;
|
||||
PCA9685::Time time_min;
|
||||
PCA9685::Time time_max;
|
||||
PCA9685::Time off_time;
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
@@ -3,26 +3,26 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Constants.h"
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
const uint8_t device_addresses[DEVICE_COUNT] =
|
||||
const PCA9685::DeviceAddress device_addresses[DEVICE_COUNT] =
|
||||
{
|
||||
0x40,
|
||||
0x41,
|
||||
0x42
|
||||
};
|
||||
const uint8_t device_index = 0;
|
||||
const PCA9685::DeviceIndex = 0;
|
||||
|
||||
const size_t output_enable_pin = 2;
|
||||
const PCA9685::Pin output_enable_pin = 2;
|
||||
|
||||
const size_t loop_delay = 100;
|
||||
const uint16_t frequency = 200;
|
||||
const uint16_t time_increment = 100;
|
||||
const PCA9685::Frequency frequency = 200;
|
||||
const PCA9685::Time time_increment = 100;
|
||||
|
||||
const uint8_t channel = 0;
|
||||
const PCA9685::Channel channel = 0;
|
||||
}
|
||||
|
||||
@@ -3,25 +3,26 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
#include <Arduino.h>
|
||||
#include <PCA9685.h>
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
enum{DEVICE_COUNT=3};
|
||||
extern const uint8_t device_addresses[DEVICE_COUNT];
|
||||
extern const uint8_t device_index;
|
||||
extern const PCA9685::DeviceAddress device_addresses[DEVICE_COUNT];
|
||||
extern const PCA9685::DeviceIndex;
|
||||
|
||||
extern const size_t output_enable_pin;
|
||||
extern const PCA9685::Pin output_enable_pin;
|
||||
|
||||
extern const size_t loop_delay;
|
||||
extern const uint16_t frequency;
|
||||
extern const uint16_t time_increment;
|
||||
extern const PCA9685::Frequency frequency;
|
||||
extern const PCA9685::Time time_increment;
|
||||
|
||||
extern const uint8_t channel;
|
||||
extern const PCA9685::Channel channel;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
PCA9685 pca9685;
|
||||
|
||||
uint16_t time_min;
|
||||
uint16_t time_max;
|
||||
uint16_t on_time;
|
||||
PCA9685::Time time_min;
|
||||
PCA9685::Time time_max;
|
||||
PCA9685::Time on_time;
|
||||
|
||||
void setup()
|
||||
{
|
||||
pca9685.setWire(Wire);
|
||||
for (uint8_t device_index=0; device_index<constants::DEVICE_COUNT; ++device_index)
|
||||
for (PCA9685::DeviceIndex=0; device_index<constants::DEVICE_COUNT; ++device_index)
|
||||
{
|
||||
pca9685.addDevice(constants::device_addresses[device_index]);
|
||||
}
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Constants.h"
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
const uint8_t device_address = 0x40;
|
||||
const size_t output_enable_pin = 2;
|
||||
const PCA9685::DeviceAddress device_address = 0x40;
|
||||
const PCA9685::Pin output_enable_pin = 2;
|
||||
|
||||
const size_t loop_delay = 100;
|
||||
|
||||
const uint8_t channel = 0;
|
||||
const PCA9685::Channel channel = 0;
|
||||
|
||||
const uint16_t servo_pulse_duration_min = 900;
|
||||
const uint16_t servo_pulse_duration_max = 2100;
|
||||
const uint16_t servo_pulse_duration_increment = 100;
|
||||
const PCA9685::DurationMicroseconds servo_pulse_duration_min = 900;
|
||||
const PCA9685::DurationMicroseconds servo_pulse_duration_max = 2100;
|
||||
const PCA9685::DurationMicroseconds servo_pulse_duration_increment = 100;
|
||||
}
|
||||
|
||||
@@ -3,24 +3,25 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
#include <Arduino.h>
|
||||
#include <PCA9685.h>
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
extern const uint8_t device_address;
|
||||
extern const size_t output_enable_pin;
|
||||
extern const PCA9685::DeviceAddress device_address;
|
||||
extern const PCA9685::Pin output_enable_pin;
|
||||
|
||||
extern const size_t loop_delay;
|
||||
|
||||
extern const uint8_t channel;
|
||||
extern const PCA9685::Channel channel;
|
||||
|
||||
extern const uint16_t servo_pulse_duration_min;
|
||||
extern const uint16_t servo_pulse_duration_max;
|
||||
extern const uint16_t servo_pulse_duration_increment;
|
||||
extern const PCA9685::DurationMicroseconds servo_pulse_duration_min;
|
||||
extern const PCA9685::DurationMicroseconds servo_pulse_duration_max;
|
||||
extern const PCA9685::DurationMicroseconds servo_pulse_duration_increment;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
PCA9685 pca9685;
|
||||
|
||||
uint16_t servo_pulse_duration;
|
||||
PCA9685::DurationMicroseconds servo_pulse_duration;
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Constants.h"
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
const uint8_t device_address = 0x40;
|
||||
const size_t output_enable_pin = 2;
|
||||
const PCA9685::DeviceAddress device_address = 0x40;
|
||||
const PCA9685::Pin output_enable_pin = 2;
|
||||
|
||||
const size_t loop_delay = 8000;
|
||||
const uint16_t frequency = 200;
|
||||
const uint8_t channel = 0;
|
||||
const PCA9685::Frequency frequency = 200;
|
||||
const PCA9685::Channel channel = 0;
|
||||
|
||||
const Example examples[EXAMPLE_COUNT] =
|
||||
{
|
||||
|
||||
@@ -3,28 +3,29 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
#include <Arduino.h>
|
||||
#include <PCA9685.h>
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
extern const uint8_t device_address;
|
||||
extern const size_t output_enable_pin;
|
||||
extern const PCA9685::DeviceAddress device_address;
|
||||
extern const PCA9685::Pin output_enable_pin;
|
||||
|
||||
extern const size_t loop_delay;
|
||||
extern const uint16_t frequency;
|
||||
extern const uint8_t channel;
|
||||
extern const PCA9685::Frequency frequency;
|
||||
extern const PCA9685::Channel channel;
|
||||
|
||||
enum{EXAMPLE_COUNT=4};
|
||||
|
||||
struct Example
|
||||
{
|
||||
double duty_cycle;
|
||||
double percent_delay;
|
||||
PCA9685::Percent duty_cycle;
|
||||
PCA9685::Percent percent_delay;
|
||||
};
|
||||
|
||||
extern const Example examples[EXAMPLE_COUNT];
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Constants.h"
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
const uint8_t device_address = 0x40;
|
||||
const size_t output_enable_pin = 2;
|
||||
const PCA9685::DeviceAddress device_address = 0x40;
|
||||
const PCA9685::Pin output_enable_pin = 2;
|
||||
|
||||
const size_t loop_delay = 8000;
|
||||
const uint16_t frequency = 200;
|
||||
const uint8_t channel = 0;
|
||||
const PCA9685::Frequency frequency = 200;
|
||||
const PCA9685::Channel channel = 0;
|
||||
|
||||
const Example examples[EXAMPLE_COUNT] =
|
||||
{
|
||||
|
||||
@@ -3,28 +3,29 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
#include <Arduino.h>
|
||||
#include <PCA9685.h>
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
extern const uint8_t device_address;
|
||||
extern const size_t output_enable_pin;
|
||||
extern const PCA9685::DeviceAddress device_address;
|
||||
extern const PCA9685::Pin output_enable_pin;
|
||||
|
||||
extern const size_t loop_delay;
|
||||
extern const uint16_t frequency;
|
||||
extern const uint8_t channel;
|
||||
extern const PCA9685::Frequency frequency;
|
||||
extern const PCA9685::Channel channel;
|
||||
|
||||
enum{EXAMPLE_COUNT=4};
|
||||
|
||||
struct Example
|
||||
{
|
||||
uint16_t on_time;
|
||||
uint16_t off_time;
|
||||
PCA9685::Time on_time;
|
||||
PCA9685::Time off_time;
|
||||
};
|
||||
|
||||
extern const Example examples[EXAMPLE_COUNT];
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Constants.h"
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
const uint8_t device_address = 0x40;
|
||||
const size_t output_enable_pin = 2;
|
||||
const PCA9685::DeviceAddress device_address = 0x40;
|
||||
const PCA9685::Pin output_enable_pin = 2;
|
||||
|
||||
const size_t loop_delay = 8000;
|
||||
const uint16_t frequency = 200;
|
||||
const uint8_t channel = 0;
|
||||
const PCA9685::Frequency frequency = 200;
|
||||
const PCA9685::Channel channel = 0;
|
||||
|
||||
const Example examples[EXAMPLE_COUNT] =
|
||||
{
|
||||
|
||||
@@ -3,28 +3,29 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
#include <Arduino.h>
|
||||
#include <PCA9685.h>
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
extern const uint8_t device_address;
|
||||
extern const size_t output_enable_pin;
|
||||
extern const PCA9685::DeviceAddress device_address;
|
||||
extern const PCA9685::Pin output_enable_pin;
|
||||
|
||||
extern const size_t loop_delay;
|
||||
extern const uint16_t frequency;
|
||||
extern const uint8_t channel;
|
||||
extern const PCA9685::Frequency frequency;
|
||||
extern const PCA9685::Channel channel;
|
||||
|
||||
enum{EXAMPLE_COUNT=4};
|
||||
|
||||
struct Example
|
||||
{
|
||||
uint16_t pulse_width;
|
||||
uint16_t phase_shift;
|
||||
PCA9685::Duration pulse_width;
|
||||
PCA9685::Duration phase_shift;
|
||||
};
|
||||
|
||||
extern const Example examples[EXAMPLE_COUNT];
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Constants.h"
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
const uint8_t device_address = 0x40;
|
||||
const size_t output_enable_pin = 2;
|
||||
const PCA9685::DeviceAddress device_address = 0x40;
|
||||
const PCA9685::Pin output_enable_pin = 2;
|
||||
|
||||
const long baud = 115200;
|
||||
|
||||
const size_t loop_delay = 100;
|
||||
const uint16_t frequency = 200;
|
||||
const uint16_t time_increment = 400;
|
||||
const double epsilon = 0.001;
|
||||
const PCA9685::Frequency frequency = 200;
|
||||
const PCA9685::Time time_increment = 400;
|
||||
const PCA9685::Percent epsilon = 0.001;
|
||||
}
|
||||
|
||||
@@ -3,22 +3,23 @@
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
// Peter Polidoro peterpolidoro@gmail.com
|
||||
// Peter Polidoro peter@polidoro.io
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
#include <Arduino.h>
|
||||
#include <PCA9685.h>
|
||||
|
||||
|
||||
namespace constants
|
||||
{
|
||||
extern const uint8_t device_address;
|
||||
extern const size_t output_enable_pin;
|
||||
extern const PCA9685::DeviceAddress device_address;
|
||||
extern const PCA9685::Pin output_enable_pin;
|
||||
|
||||
extern const long baud;
|
||||
extern const size_t loop_delay;
|
||||
extern const uint16_t frequency;
|
||||
extern const uint16_t time_increment;
|
||||
extern const double epsilon;
|
||||
extern const PCA9685::Frequency frequency;
|
||||
extern const PCA9685::Time time_increment;
|
||||
extern const PCA9685::Percent epsilon;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,25 +7,25 @@
|
||||
|
||||
PCA9685 pca9685;
|
||||
|
||||
uint16_t time_min;
|
||||
uint16_t time_max;
|
||||
PCA9685::Time time_min;
|
||||
PCA9685::Time time_max;
|
||||
|
||||
uint8_t channel;
|
||||
PCA9685::Channel channel;
|
||||
|
||||
uint16_t on_time_set;
|
||||
uint16_t off_time_set;
|
||||
uint16_t on_time_get;
|
||||
uint16_t off_time_get;
|
||||
PCA9685::Time on_time_set;
|
||||
PCA9685::Time off_time_set;
|
||||
PCA9685::Time on_time_get;
|
||||
PCA9685::Time off_time_get;
|
||||
|
||||
uint16_t pulse_width_set;
|
||||
uint16_t phase_shift_set;
|
||||
uint16_t pulse_width_get;
|
||||
uint16_t phase_shift_get;
|
||||
PCA9685::Duration pulse_width_set;
|
||||
PCA9685::Duration phase_shift_set;
|
||||
PCA9685::Duration pulse_width_get;
|
||||
PCA9685::Duration phase_shift_get;
|
||||
|
||||
double duty_cycle_set;
|
||||
double percent_delay_set;
|
||||
double duty_cycle_get;
|
||||
double percent_delay_get;
|
||||
PCA9685::Percent duty_cycle_set;
|
||||
PCA9685::Percent percent_delay_set;
|
||||
PCA9685::Percent duty_cycle_get;
|
||||
PCA9685::Percent percent_delay_get;
|
||||
|
||||
void setup()
|
||||
{
|
||||
@@ -67,7 +67,7 @@ void loop()
|
||||
on_time_set = time_min;
|
||||
off_time_set = time_max;
|
||||
}
|
||||
for (uint8_t channel=0; channel < pca9685.getChannelCount(); ++channel)
|
||||
for (PCA9685::Channel channel=0; channel < pca9685.getChannelCount(); ++channel)
|
||||
{
|
||||
Serial << "frequency: " << pca9685.getFrequency() << "\n";
|
||||
Serial << "channel: " << channel << ", on_time_set: " << on_time_set << ", off_time_set: " << off_time_set << "\n";
|
||||
|
||||
Reference in New Issue
Block a user