From c66c052b74c9fcf9e7a8eed8b63953d13dfa2c59 Mon Sep 17 00:00:00 2001 From: Trevor McDonald <75909106+xylocoder@users.noreply.github.com> Date: Mon, 14 Feb 2022 14:10:54 -0500 Subject: [PATCH] Create ArduinoUpdated --- ArduinoUpdated | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 ArduinoUpdated diff --git a/ArduinoUpdated b/ArduinoUpdated new file mode 100644 index 0000000..7266c1a --- /dev/null +++ b/ArduinoUpdated @@ -0,0 +1,51 @@ +#include +NewPing sonar(5,6,20); + +int pressurePin = A5; +int force; +const int sensor1 = A1; // Analog input pin that the potentiometer is attached to +const int sensor2 = A2; // Analog input pin that the potentiometer is attached to +const int sensor3 = A3; // Analog input pin that the potentiometer is attached to + +int sensorValue1 = 0; // value read from the pot +int sensorValue2 = 0; // value read from the pot +int sensorValue3 = 0; // value read from the pot +const int sensor4 = A0; // Analog input pin that the potentiometer is attached to +const int sensor5 = A4; // Analog input pin that the potentiometer is attached to + + +int sensorRotationValue4 = 0; // value read from the pot +int sensorDistanceValue5 = 0; // value read from the pot +int filletTotal = 0; + + +void setup() { + // initialize serial communications at 9600 bps: + Serial.begin(9600); +} + +void loop() { + // read the analog in value: + sensorValue1 = analogRead(sensor1); + sensorValue2 = analogRead(sensor2); + sensorValue3 = analogRead(sensor3); + force = analogRead(pressurePin); + sensorRotationValue4 = analogRead(sensor4); + sensorDistanceValue5 = analogRead(sensor5); + + Serial.print(sonar.ping_cm()); + Serial.print(","); + Serial.print(sensorValue1); + Serial.print(","); + Serial.print(sensorValue2); + Serial.print(","); + Serial.print(sensorValue3); + Serial.print(","); + Serial.print(force); + Serial.print(","); + Serial.print(sensorRotationValue4); + Serial.print(","); + Serial.print(sensorDistanceValue5); + Serial.println(","); + delay(100); +}