Can anyone tell me how to do my project which is connect the flex sensor and the buzzer on Arduino uno , when it get curve it make a sound and then send sms using gsm shield
It will be in a jacket so the flex sensor should measure the curve then beep and send report .
Then write what you need for each -board, wires, power, pins, connections... and draw an interconnect diagram. After you have the equipment, write a sketch to test each device alone. And when that is done, merge the code so none of the code breaks, and everything talks and listens. Every step, when you need help, revisit your thread (here) and show what you have.
Okay. Start by loading FILE >> EXAMPLES >> "Blink" sketch, and get that running. Then, learn what the parts of the code do. Then make the code do other blinks. Then you can work on making other stuff in your project. (Hey, I must be offline for a day. Others can help)
I found the code for flex and buzzer
But I want it to make sound when the jacket curve just for atleast 1 minute then stop not when the flex sensor get straight , so it’s not make noises.
do you know how to coding for gsm shield so when the flex sensor bend and the buzzer make a sound it’s send a sms directly
Please I need help
And this is the code for flex sensor and buzzer:
int flexs = A0; // flex sensor is connected with pin A0 of the arduino
int flexdata = 0;
int buzzer = 5; // a buzzer is connected with pin 5 of arduino which is the pwm pin.
Be sure to format and paste your code inside the code tag (</>) so it looks like this:
int flexs = A0; // flex sensor is connected with pin A0 of the arduino
int flexdata = 0;
int buzzer = 5; // a buzzer is connected with pin 5 of arduino which is the pwm pin.
void setup() {
Serial.begin(9600);
pinMode(flexs, INPUT);
pinMode(buzzer, OUTPUT);
}
void loop() {
flexdata = analogRead(flexs);
Serial.print("flex value;");
Serial.print(flexdata);
Serial.println("");
if (flexdata < 220) {
analogWrite(buzzer, 150);
}
if (flexdata > 220) {
analogWrite(buzzer, 0);
}
delay(1000);
}
You have a buzzer if the flex value is greater than 220, so put a delay inside the if() statement to keep the buzzer on (analogWrite(buzzer, 150)) for the length of time you want before turning the buzzer off ('analogWrite(buzzer, 0)`).