Go Down

Topic: Sign language with flex sensors (Read 1 time) previous topic - next topic

shrikant_arts

yes Sparkfun code is working but with my code it isnt?

6v6gt

What output do you get from the following Serial.print() statement ?

Code: [Select]
Serial.print(value1);

shrikant_arts

nothing   but a message " food ",that occurs in the serial monitor  too and on lcd too.

6v6gt

If that is not what you are expecting, then post your latest code (between code tags) and an updated wiring diagram and a description of what you are expecting to see.

TomGeorge

#19
Feb 17, 2018, 01:59 am Last Edit: Feb 17, 2018, 02:04 am by TomGeorge
Hi,
Can you try this code?
Tell us what the LCD displays when you leave the flex sensor unflexed and then flexed.

Tell us what the IDE monitor displays when you leave the flex sensor unflexed and then flexed.


Code: [Select]

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int flexPin1 = A0;
int value1;
void setup() {
  // put your setup code here, to run once:
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("Sign Language");
  Serial.begin(9600);
  delay(200);
}

void loop() {
  // put your main code here, to run repeatedly:
  value1 = analogRead(flexPin1);
  Serial.print(value1);
  value1 = map(value1, 760, 950, 0, 255);
  if (value1 > 80)
  {
    lcd.setCursor(0, 0);
    lcd.print("             ");
    lcd.setCursor(0, 0);
    lcd.print("Foods");
    digitalWrite(6, HIGH);
    Serial.println("   Foods");
    delay(500);
  }
  else
  {
    lcd.setCursor(0, 0);
    lcd.print("             ");
    lcd.setCursor(0, 0);
    lcd.print("Sign Language");
    lcd.clear();
    digitalWrite(6, LOW);
    Serial.println("   Sign Language");
    delay(500);
  }

}


Do you have a DMM to measure some voltages?
Can you post a picture of your project please?

Thanks.. Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

shrikant_arts

hey buddy.
the code isnot working, here is the screenshot of serial monitor what it is getting displayed.
and here are my connection of lcd and flexsensor.


pin 1 of lcd-GND
pin2-5v
pin3-connected with middle potentiometer
pin4-12
pin5-gnd
pin6-11

d7-2,
d6-3
d5-4
d4-5



15-5v
16-gnd

flex sensor connnected wit 10 k reesistor:
one pin goes to 5v and other pin goes to A0 and one for connection s shown in sparkfun.

now when i run the program.nothing displays on lcd just getting displayed on serial monitor only

shrikant_arts


TomGeorge

Okay the code is workig in you IDE monitor, you need to change the 80 threshhold to 150.

Try this and see what the IDE monitor shows.

Code: [Select]

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int flexPin1 = A0;
int value1;
void setup() {
  // put your setup code here, to run once:
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("Sign Language");
  Serial.begin(9600);
  delay(200);
}

void loop() {
  // put your main code here, to run repeatedly:
  value1 = analogRead(flexPin1);
  Serial.print(value1);
  if (value1 > 150)
  {
    lcd.setCursor(0, 0);
    lcd.print("             ");
    lcd.setCursor(0, 0);
    lcd.print("Foods");
    digitalWrite(6, HIGH);
    Serial.println("   Foods");
    delay(500);
  }
  else
  {
    lcd.setCursor(0, 0);
    lcd.print("             ");
    lcd.setCursor(0, 0);
    lcd.print("Sign Language");
    lcd.clear();
    digitalWrite(6, LOW);
    Serial.println("   Sign Language");
    delay(500);
  }

}


Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

shrikant_arts

bro
now when i run this code,
when i bend the flexsensor
the message food vanishes from the lcd
and whn i keep the flexsensor straight food message appears on lcd.
as i bend  the message goes and whne i pull it off the straight the message "Food" comesback

TomGeorge

#24
Feb 17, 2018, 06:07 am Last Edit: Feb 17, 2018, 06:08 am by TomGeorge
Hi;
Okay
Change this.

Code: [Select]
if (value1 > 150)
To,
This;

Code: [Select]
if (value1 < 150)

Or it is it now functioning as you need it?
Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

shrikant_arts

yes got it :) :P
thanks.
but im nt getting the
void setup()
 message sign language.?

TomGeorge

#26
Feb 17, 2018, 07:05 am Last Edit: Feb 17, 2018, 07:05 am by TomGeorge
Hi,
Try this.


Code: [Select]

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int flexPin1 = A0;
int value1;
void setup() {
  // put your setup code here, to run once:
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("Sign Language");
  Serial.begin(9600);
  delay(200);
}

void loop() {
  // put your main code here, to run repeatedly:
  value1 = analogRead(flexPin1);
  Serial.print(value1);
  if (value1 > 150)
  {
    lcd.setCursor(0, 1);
    lcd.print("             ");
    lcd.setCursor(0, 1);
    lcd.print("Food");
    digitalWrite(6, HIGH);
    Serial.println("   Food");
    delay(500);
  }
  else
  {
    lcd.setCursor(0, 1);
    lcd.print("             ");
    lcd.setCursor(0, 1);
    lcd.print("Sign Language");
    lcd.clear();
    digitalWrite(6, LOW);
    Serial.println("   Sign Language");
    delay(500);
  }

}


I have left the "Sign Language" Heading as the top line, and moved the response to the flex to the next line.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

shrikant_arts


shrikant_arts

hey
now i have been using 3 flex sensors and im getting a issue in connection with the cod ealso
here is the code
help me out 



#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define FLEX_1  A0
#define FLEX_2  A1
#define FLEX_3  A2
const int sMin=950;
const int sMax=980;

void setup() {

  pinMode(FLEX_1,INPUT);
  pinMode(FLEX_2,INPUT);
  pinMode(FLEX_3,INPUT);
  // put your setup code here, to run once:
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("Sign Language");
  Serial.begin(9600);
  delay(500);
}

void loop() {
  // put your main code here, to run repeatedly:
int s1=analogRead(A0);
int s2=analogRead(A1);
int s3=analogRead(A2);

if((s1>s2) && (s1>s3))
{
  int range1=map(s1,sMin,sMax,0,3);
  switch(range1)
  {
    case 0:
    lcd.noDisplay();
    Serial.println("no");
    break;
    case 1:
    lcd.display();
    lcd.setCursor(0,0);
    lcd.print("help");
    delay(1000);
    Serial.println("yes");
    break;
  }
}
if((s2>s1) && (s2>s3))
{
  int range2=map(s2,sMin,sMax,0,3);
  switch(range2)
  {
    case 0:
    lcd.noDisplay();
    Serial.println("no high");
    break;
    case 1:
    lcd.display();
    lcd.setCursor(0,0);
    lcd.print("call");
    delay(1000);
    Serial.println("yes call");
    break;
  }
}
if((s3>s1) && (s3>s2))
{
  int range3=map(s3,sMin,sMax,0,3);
  switch(range3)
  {
    case 0:
    lcd.noDisplay();
    Serial.println("no high");
    break;
    case 1:
    lcd.display();
    lcd.setCursor(0,0);
    lcd.print("call");
    delay(1000);
    Serial.println("yes call");
    break;
  }
}
}
 

ChrisTenone

That's a lot of code shrikant_arts!!

Here how to use a really cool feature of this website:

Edit your last post by typing "[code]" right before your code lines and then "[/code]" right after it. All of your code will be put into a scrolling frame that uses a monospaced font. The code can easily be copied whole, and doesn't take up nearly so much room!
Atmosphere carries combustion vapors to places where they will do good instead of harm - Mike Faraday's 'History of a Candle': https://www.youtube.com/watch?v=6W0MHZ4jb4A

Whoops ::)

Go Up