2024-09-06 13:33:19 +00:00
|
|
|
#include "definitions.h"
|
|
|
|
#include "vacuum.h"
|
|
|
|
#include "servo.h"
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
2024-09-10 09:44:19 +00:00
|
|
|
pinMode(PIN_VIBRATION,OUTPUT);
|
|
|
|
analogWrite(PIN_VIBRATION,0);
|
|
|
|
|
2024-09-06 13:33:19 +00:00
|
|
|
pinMode(PIN_BUTTON,INPUT_PULLDOWN);
|
|
|
|
|
|
|
|
initVacuum();
|
|
|
|
|
|
|
|
|
|
|
|
pinMode(PIN_INPUTARM1,INPUT);
|
2024-09-06 14:51:50 +00:00
|
|
|
|
2024-09-10 09:44:19 +00:00
|
|
|
pinMode(PIN_INPUTAUX,INPUT);
|
|
|
|
|
2024-09-06 14:51:50 +00:00
|
|
|
initServos();
|
2024-09-06 13:33:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
unsigned long loopmillis=millis();
|
|
|
|
|
|
|
|
bool vac=digitalRead(PIN_BUTTON); //Temporary Vacuum Button
|
|
|
|
setVacuum(vac);
|
|
|
|
|
|
|
|
loopVacuum(loopmillis);
|
|
|
|
|
2024-09-06 14:51:50 +00:00
|
|
|
loopServos(loopmillis);
|
|
|
|
|
2024-09-06 13:33:19 +00:00
|
|
|
|
|
|
|
//Print Debug Information
|
|
|
|
static unsigned long last_print=0;
|
|
|
|
if (loopmillis - last_print >100) {
|
|
|
|
last_print=loopmillis;
|
2024-09-06 14:51:50 +00:00
|
|
|
//printVacuumValues();
|
|
|
|
//Serial.print(" Vac="); Serial.print(vac);
|
|
|
|
|
|
|
|
printServoDebug();
|
|
|
|
|
2024-09-06 13:33:19 +00:00
|
|
|
|
|
|
|
Serial.println();
|
|
|
|
Serial.println();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|