Commit 9e620149 authored by Tim Soderstrom's avatar Tim Soderstrom

Prepping for attiny85

parent 21e4a8ee
......@@ -29,7 +29,6 @@
// #define MOTOR_MIN_RPM 24
#define MOTOR_MIN_PCT 50
// How long to free spin motor when changing direction
// #define COAST_MOTOR_MILLIS 500
#define COAST_MOTOR_MILLIS 1000
// How many seconds between direction changes
......@@ -43,9 +42,15 @@
/*******
* Pins
*******/
/*
const byte motorSpeed = 5;
const byte motorX = 6;
const byte motorY = 7;
*/
/* For ATTiny85 */
const byte motorSpeed = A1;
const byte motorX = A2;
const byte motorY = A3;
/************
* Variables
......@@ -106,7 +111,6 @@ void controlMotor(byte speed, byte directionInterval)
motorCoasting = true;
if (millis() - previousCoastMillis >= COAST_MOTOR_MILLIS && motorCoast)
{
Serial.println("Done Coasting");
motorCoasting = false;
}
}
......@@ -124,14 +128,12 @@ void controlMotor(byte speed, byte directionInterval)
// If we are not currently coasting, but
else if(!motorCoast)
{
Serial.println("Coast Requested");
previousCoastMillis = millis();
motorCoast = true;
}
// Now Change Direction
else if(!motorCoasting)
{
Serial.println("Motor Running");
analogWrite(motorSpeed, toSpeed(speed));
changeDirection();
motorCoast = false;
......@@ -160,14 +162,12 @@ void changeDirection()
{
if(motorDirection == FORWARD)
{
Serial.println("Motor: Reverse");
digitalWrite(motorX, LOW);
digitalWrite(motorY, HIGH);
motorDirection = REVERSE;
}
else
{
Serial.println("Motor: Forward");
digitalWrite(motorX, HIGH);
digitalWrite(motorY, LOW);
motorDirection = FORWARD;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment