For this assignment, I added two potentiometers to the programmable air board as well as rewiring some of the plumbing. I mapped suck and blow to the two pots and was able to make the syringe suck in and out at a slightly diminished level. I kept this simple because I really wanted to try to redo all of the air routing, and I am happy that I did, becuase it’s much trickier than I expected.
// Programmable-Air
// Author: tinkrmind
// <https://github.com/orgs/Programmable-Air>
//
// Basic example of using Suck function of the Programmable-Air board.
// The neopixels show pressure. Cyan for low pressure and Purple for high pressure
// Brighter color means more extreme pressure. Bright cyan means lower pressure than dim cyan and brighter purple means higher pressure tham dim purple. At atmospheric presure,lights will be off.
//
// PCB v0.3/v0.4/v0.5
#include "programmable_air.h"
#define DEBUG 1
const int POT_BLOW_PIN = A0;
const int POT_SUCK_PIN = A5;
int blowAmount = 0;
int suckAmount = 0;
void setup() {
initializePins();
}
void loop() {
blowAmount = map(analogRead(POT_BLOW_PIN), 0, 1023, 0, 100);
suckAmount = map(analogRead(POT_SUCK_PIN), 0, 1023, 0, 100);
delayWhileReadingPressure(200);
// if the BLUE button is pressed suck air out of the output, else, vent to atmosphere
if(readBtn(BLUE)){
// switch on Pump 1 (suck) to 50% duty cycle
switchOnPump(1, suckAmount);
suck();
setValve(3, 1);
switchOnPump(2, blowAmount);
blow();
} else{
switchOffPumps();
vent();
}
}

