Hi,
I'm absolutley new in Arduino community and electronics.
I'm working on my PhD and I need some direct application using arduino and sensors.
These days I had been trying to figure out a program using a flex sensor with a calibration system and direct degrees flexion in a lcd display to support an electrogoniometer with direct flexion feedback. However the code don't really works.
I post the code, I will be very glad if somebody can check out the project.
I think that i used intexisting combinations which I didn't find any reference on the net, like print serials data in a subcommand on a lcd.
Furthermor, when Im verifing the code I have problems with the liquidCristyal name type and when i upload the library #liquidcrystal.u I don't understand anything whats going on.
Thank you very much. Hope you can help me.
LiquidCrystal lcd(5, 6, 7); // pins 5 6 7
int led = 13; //device on
const int buttonPin = 3; // push botton caliber
const int Flexpin = 0; // flex sensor
void setup()
{
pinMode(led, OUTPUT);
pinMode(buttonPin, INPUT);
Serial.begin(9600);
LiquidCrystal.begin(16,2);
LiquidCrystal.print("CALIBRATION to 0ยบ ---- PRESS BUTTON");
}
void loop ()
{
int sensor, degrees;
sensor = analogRead(0);
degrees = map (sensor, 768, 853, 0, 180); //values of senor on rest and flexion followed by Range Of Motion to track
buttonPin = digitalRead(buttonPin);
if (buttonPin == HIGH) {
{int sensorValue = analogRead(0);
{int calibrationVal = 0;
{float voltage = sensorValue * (5.0 / 1023.0);
{digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(100);
digitalWrite(led, HIGH);
}}}}}
LiquidCrystal.begin(16,2);
LiquidCrystal.print(Serial.print(sensor,DEC));
LiquidCrystal.print(Serial.print("JOINT FLEXION degrees:"));
}