This is a basic implementation of a PID controller on an Arduino.
To replicate this, wire up the system as shown below:
**THIS IS THE OLD CODE, NEW CODE HERE: https://github.com/careyi3/rover **
To run as a service copy rover.service
to the location /lib/systemd/system/
. From here then run the following two commands.
sudo systemctl enable rover
sudo systemctl start rover
#define ENCODER_OPTIMIZE_INTERRUPTS | |
#include <AccelStepper.h> | |
#include <PID_v1.h> | |
#include <Encoder.h> | |
const bool inverted = false; | |
const int stepMode = 3; | |
const int stepModes[6][5] = { | |
{5, 1, 0, 0, 0}, |
#include "Wire.h" | |
#include "Kalman.h" | |
const int MPU_ADDR = 0x68; | |
const double MICRO_SECOND = 1000000.00; | |
const double INTERVAL = 1000.0; | |
double dt, timer = 0.0; | |
double gyro_y_offset, accl_x_offset, accl_z_offset; |
#include <DigitalIO.h> | |
#include <PsxControllerHwSpi.h> | |
const byte PIN_PS2_ATT = 10; | |
PsxControllerHwSpi<PIN_PS2_ATT> psx; | |
boolean connected = false; | |
byte lxOld, lyOld, rxOld, ryOld; | |
PsxButtons oldButtons; |
#include <AccelStepper.h> | |
const int speed = 700; | |
const double accl = 0.05; | |
AccelStepper stepper = AccelStepper(AccelStepper::DRIVER, DD3, DD2); | |
long prev_speed; | |
void setup() | |
{ |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
class Solution { | |
static void Main(String[] args) { | |
string a = Console.ReadLine(); | |
string b = Console.ReadLine(); |