Skip to main content
I removed the comment part but kept the rest because I do not want the rest of it to be taken as gospel truth, in part or whole.
Source Link

I can't comment yet but I can delete this after Robbie sees it if it is a problem.

I am just learning this program so I could be way off on this and I apologize if I am.

Instead of the loop inside of void setup() initialize each pin individually. Also you are telling the system to start the MIDI and set the pinMode 3 times.

Inside the Void checkSensor function you set all the sensorHits every time the function runs, you might save a little bit you do lastSensorHit(i).

I just noticed you have the if command running this function as (int i = 0; i < numberOfSensors; i++). You don't have a sensor 0, so you might want to change that to (int i = 1; i < numberOfSensors+1; i++)// or just change it to 4.

Inside the function checkSensor, it doesn't look your variable val has a value.

if (sensorHit1 != lastSensorHit1) this is still under the same function as before and it is going to run once per channel that you specified in the controlling if function. Maybe move this into the void loop() or create its own function?

I can't comment yet but I can delete this after Robbie sees it if it is a problem.

I am just learning this program so I could be way off on this and I apologize if I am.

Instead of the loop inside of void setup() initialize each pin individually. Also you are telling the system to start the MIDI and set the pinMode 3 times.

Inside the Void checkSensor function you set all the sensorHits every time the function runs, you might save a little bit you do lastSensorHit(i).

I just noticed you have the if command running this function as (int i = 0; i < numberOfSensors; i++). You don't have a sensor 0, so you might want to change that to (int i = 1; i < numberOfSensors+1; i++)// or just change it to 4.

Inside the function checkSensor, it doesn't look your variable val has a value.

if (sensorHit1 != lastSensorHit1) this is still under the same function as before and it is going to run once per channel that you specified in the controlling if function. Maybe move this into the void loop() or create its own function?

I am just learning this program so I could be way off on this and I apologize if I am.

Instead of the loop inside of void setup() initialize each pin individually. Also you are telling the system to start the MIDI and set the pinMode 3 times.

Inside the Void checkSensor function you set all the sensorHits every time the function runs, you might save a little bit you do lastSensorHit(i).

I just noticed you have the if command running this function as (int i = 0; i < numberOfSensors; i++). You don't have a sensor 0, so you might want to change that to (int i = 1; i < numberOfSensors+1; i++)// or just change it to 4.

Inside the function checkSensor, it doesn't look your variable val has a value.

if (sensorHit1 != lastSensorHit1) this is still under the same function as before and it is going to run once per channel that you specified in the controlling if function. Maybe move this into the void loop() or create its own function?

Source Link

I can't comment yet but I can delete this after Robbie sees it if it is a problem.

I am just learning this program so I could be way off on this and I apologize if I am.

Instead of the loop inside of void setup() initialize each pin individually. Also you are telling the system to start the MIDI and set the pinMode 3 times.

Inside the Void checkSensor function you set all the sensorHits every time the function runs, you might save a little bit you do lastSensorHit(i).

I just noticed you have the if command running this function as (int i = 0; i < numberOfSensors; i++). You don't have a sensor 0, so you might want to change that to (int i = 1; i < numberOfSensors+1; i++)// or just change it to 4.

Inside the function checkSensor, it doesn't look your variable val has a value.

if (sensorHit1 != lastSensorHit1) this is still under the same function as before and it is going to run once per channel that you specified in the controlling if function. Maybe move this into the void loop() or create its own function?