Hi All
I'm after a bit of help as I'm fairly new to this programming language and having trouble understanding a few things. for this project I using an Arduino Uno, a 16 port Servo Hat, 6 Hall effect sensors and a Fotex 40 amp Relay and 5 MG995 servos.
This is the code that I've downloaded for an automated dust collection system for my woodwork shop. the basis idea is that when a Hall effect sensor is triggered it sends a signal to a solid state relay to start the dust extractor to turn on as well as opening a blast gate to allow airflow through.
the instructional video I watched on YouTube seamed to skip over quite a lot although I have most of this worked out, I'm still confused about a couple of things.
Somewhere in this code it tells the servos how much to turn and which way to turn and delay for activating the SSR. to me it looks like line 52 but not sure.
also starting at line 61, I think this instructs the Arduino of which gates to activate, Presuming 1=open and 0=Closed but again im not sure.
Can any one please help me to understand this?
Many thanks
/*
* This code is for the project at
* http://www.iliketomakestuff.com/how-to-automate-a-dust-collection-system-arduino
* http://www.ilimakestuff.com/how-to-automate-a-dust-collection-system-arduino
* All of the components are list on the url above.
*
This script was created by Bob Clagett for I Like To Make Stuff
For more projects, check out iliketomakestuff.com
Includes Modified version of "Measuring AC Current Using ACS712"
https://web.archive.org/web/20190928042820/http://henrysbench.capnfatz.com/henrys-bench/arduino-current-measurements/acs712-arduino-ac-current-tutorial/
Parts of this sketch were taken from the keypad and servo sample sketches that comes with the keypad and servo libraries.
Uses https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library
*/
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);
// Depending on your servo make, the pulse width min and max may vary, you
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
// our servo # counter
uint8_t servoCount = 6;
uint8_t servonum = 0;
const int OPEN_ALL = 100;
const int CLOSE_ALL = 99;
boolean buttonTriggered = 0;
boolean powerDetected = 0;
boolean collectorIsOn = 0;
int DC_spindown = 3000;
const int NUMBER_OF_TOOLS = 3;
const int NUMBER_OF_GATES = 6;
String tools[NUMBER_OF_TOOLS] = {"Miter Saw","Table Saw","Band Saw"}; //, "Floor Sweep"
int voltSensor[NUMBER_OF_TOOLS] = {A1,A2,A3};
long int voltBaseline[NUMBER_OF_TOOLS] = {0,0,0};
//DC right, Y, miter, bandsaw, saw Y, tablesaw, floor sweep
//Set the throw of each gate separately, if needed
int gateMinMax[NUMBER_OF_GATES][2] = {
/*open, close*/
{250,415},//DC right
{230,405},//Y
{230,405},//miter
{285,425},//bandsaw
{250,405},//saw y
{250,415},//floor sweep
};