Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions ArduinoUpdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <NewPing.h>
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);
}