With this code I’m just looking to monitor 5 sensors and obtain the values, mainly looking at the hysteresis of the sensors and seeing if this is something I could use on a larger scale ~ 60 sensors. I’m not great with programming with the Arduino software, used to graphical programming. Anyway I cant get this code to load to the Arduino, do you see any glaring errors or misuse of the code in basic terms or does it need a complete re-write? Again thank you for your time and patience. I pasted the code below: I placed notes to make it easier to understand where I’m heading with it.
// Piezo Start Voltage Read // Read A0-4 set to 100ms for start then adjust if readings are off
void setup() { //start serial at 9600 baud rate (charecters per second) Serial.begin(9600)
;void loop() { //First section Read all analog ports for the 5 flexiforce sensors //Read input on analog pin 0 int flexValue0 = analogRead(A0);
//Convert the analog reading (0-1023, comes from the 10 bit ADC on the Arduino) to Voltage (0-5v comes from the voltage out of the Arduino): float voltage0 = flexValue0 * (5.0 / 1023.0);
// Wait 100 milliseconds or adjust delay(100);
//Read input on analog pin 1 int flexValue1 = analogRead(A1);
//Convert the analog reading (0-1023, comes from the 10 bit ADC on the Arduino) to Voltage (0-5v comes from the voltage out of the Arduino): float voltage1 = flexValue1 * (5.0 / 1023.0);
// Wait 100 milliseconds or adjust delay(100);
//Read input on analog pin 2 int flexValue2 = analogRead(A2);
//Convert the analog reading (0-1023, comes from the 10 bit ADC on the Arduino) to Voltage (0-5v comes from the voltage out of the Arduino): float voltage2 = flexValue2 * (5.0 / 1023.0);
// Wait 100 milliseconds or adjust delay(100);
//Read input on analog pin 3 int flexValue3 = analogRead(A3);
//Convert the analog reading (0-1023, comes from the 10 bit ADC on the Arduino) to Voltage (0-5v comes from the voltage out of the Arduino): float voltage3 = flexValue3 * (5.0 / 1023.0);
// Wait 100 milliseconds or adjust delay(100);
//Read input on analog pin 4 int flexValue4 = analogRead(A4);
//Convert the analog reading (0-1023, comes from the 10 bit ADC on the Arduino) to Voltage (0-5v comes from the voltage out of the Arduino): float voltage4 = flexValue4 * (5.0 / 1023.0);
// Wait 100 milliseconds or adjust delay(100);
//Print colleceted values from the 5 flexiforce sensors for analog inputs A0-A4
// Print value from A0 Serial.println(voltage0);
// Print value from A1 Serial.println(voltage1);
// Print value from A2 Serial.println(voltage2);
// Print value from A3 Serial.println(voltage3);
// Print value from A4 Serial.println(voltage4);
// Wait 100 milliseconds or adjust delay(100); }
Error message:
Arduino: 1.5.7 (Windows 7), Board: "Arduino Uno"
Voltage_read_5_sensors.ino: In function 'void setup()':
Voltage_read_5_sensors.ino:12:1: error: a function-definition is not allowed here before '{' token
Voltage_read_5_sensors.ino:78:1: error: expected '}' at end of input
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.