HARMONOGRAPH SYNTH CODE
// WVN015 HARMONOGRAPH SYNTH // LOMOND CAMPBELL 2020
const int AbuttonPin = 8; const int AledPin = 12; const int AgatePin = 4;
const int BbuttonPin = 5; const int BledPin = 11; const int BgatePin = 3;
const int CledPin = 10; const int CgatePin = 2;
const int DledPin = 9; const int DgatePin = 13;
// variables will change: int AbuttonState = 0; status
int BbuttonState = 0; status
// the number of the proximity switch pin // the number of the LED pin
// the number of the gate output pin
// the number of the proximity switch pin // the number of the LED pin
// the number of the gate output pin
// the number of the LED pin
// the number of the gate output pin
// the number of the LED pin
// the number of the gate output pin
// variable for reading the proximity switch // variable for reading the proximity switch
void setup() {
// initialize the LED pin as an output: pinMode(AledPin, OUTPUT);
// initialize the proximity switch pin as an input: pinMode(AbuttonPin, INPUT);
// initialize the gate output pin as an output: pinMode(AgatePin, OUTPUT);
// initialize the LED pin as an output: pinMode(BledPin, OUTPUT);
// initialize the proximity switch pin as an input: pinMode(BbuttonPin, INPUT);
// initialize the gate output pin as an output: pinMode(BgatePin, OUTPUT);
// initialize the LED pin as an output: pinMode(CledPin, OUTPUT);
// initialize the gate output pin as an output: pinMode(CgatePin, OUTPUT);
// initialize the LED pin as an output: pinMode(DledPin, OUTPUT);
// initialize the gate output pin as an output: pinMode(DgatePin, OUTPUT);
}
void loop(){
// read the state of the proximity switch value: AbuttonState = digitalRead(AbuttonPin);
// read the state of the proximity switch value: BbuttonState = digitalRead(BbuttonPin);
// check if the proximity switch has closed. // if it has, the buttonState is HIGH:
if (AbuttonState == HIGH) {
// turn LED on: digitalWrite(AledPin, HIGH);
// send gate high: digitalWrite(AgatePin, HIGH);
digitalWrite(CledPin, HIGH);
// send gate high: digitalWrite(CgatePin, HIGH);
} else {
// turn LED off: digitalWrite(AledPin, LOW);
// send gate low: digitalWrite(AgatePin, LOW);
digitalWrite(CledPin, LOW);
// send gate low: digitalWrite(CgatePin, LOW);
}
// check if the proximity switch has closed. // if it has, the buttonState is HIGH:
if (BbuttonState == HIGH) {
// turn LED on: digitalWrite(BledPin, HIGH);
// send gate high:
digitalWrite(BgatePin, HIGH); // turn LED on:
digitalWrite(DledPin, HIGH); // send gate high
digitalWrite(DgatePin, HIGH); }
else {
// turn LED off: digitalWrite(BledPin, LOW);
// send gate low: digitalWrite(BgatePin, LOW);
// turn LED off: digitalWrite(DledPin, LOW);
// send gate low: digitalWrite(DgatePin, LOW);
} }