Skip to content
Snippets Groups Projects
ServoBehaviours.h 1.4 KiB
Newer Older
Dave Murray-Rust's avatar
Dave Murray-Rust committed
#ifndef SERVO_BEHAVIOUR_h
#define SERVO_BEHAVIOUR_h
#include <Arduino.h>
Dave Murray-Rust's avatar
Dave Murray-Rust committed
#include "Behaviours.h"
#include <Servo.h>
Matthew's avatar
Matthew committed
/**
 * [ServoGoto description]
 * @param servo [description]
 * @param name  [description]
 */
Joe Revans's avatar
Joe Revans committed
class ServoGoTo : public Behaviour
Matthew's avatar
Matthew committed
{
	Servo _servo;
Dave Murray-Rust's avatar
Dave Murray-Rust committed

public:
Joe Revans's avatar
Joe Revans committed
	ServoGoTo(Servo servo, String name = "GoTo");
Matthew's avatar
Matthew committed
	/**
	   @brief What does this do?
	 */
Matthew's avatar
Matthew committed
	char* args();
	String start(String args);
Matthew's avatar
Matthew committed
class ServoWiggle : public Behaviour
{
	Servo _servo;
	int _start_time = 0;
	int _wiggle_time = 300;
	int _num_wiggles = 5;
	int _wiggles = 0;
	int _wiggle_angle = 0;
	 //Calculate wiggle time by multiplying the angle by this...
	int _wiggle_factor = 5;
Dave Murray-Rust's avatar
Dave Murray-Rust committed

public:
Joe Revans's avatar
Joe Revans committed
	ServoWiggle(Servo servo, String name = "Wiggle", int slowness=3);
Matthew's avatar
Matthew committed
	/**
	   @brief What does this do?
	 */
Matthew's avatar
Matthew committed
	char* args();
Matthew's avatar
Matthew committed
	/**
	   @brief What does this do?
	 */
Matthew's avatar
Matthew committed
	String start(String args);
Matthew's avatar
Matthew committed
	/**
	   @brief What does this do?
	 */
Matthew's avatar
Matthew committed
	void update();
Joe Revans's avatar
Joe Revans committed
class ServoGoAndReturn : public Behaviour
Matthew's avatar
Matthew committed
{
	Servo _servo;
	int _start_angle = 0;
	int _end_angle = 180;
	int _delay = 30;
	int _num_rotations = 1;
	int _rotations = 0;
	int _pause = 500;
Joe Revans's avatar
Joe Revans committed
	ServoGoAndReturn(Servo servo, String name="GoAndReturn", int delay=30, int pause=500, int start_angle = 2, int end_angle=178 );
Matthew's avatar
Matthew committed
	/**
	   @brief What does this do?
	 */
Matthew's avatar
Matthew committed
	char* args();
Matthew's avatar
Matthew committed
	/**
	   @brief What does this do?
	 */
Matthew's avatar
Matthew committed
	String start(String args);
Matthew's avatar
Matthew committed
	/**
	   @brief What does this do?
	 */
Matthew's avatar
Matthew committed
	void update();
Dave Murray-Rust's avatar
Dave Murray-Rust committed
#endif