I need help please!

im trying to have a button switch imformation with diffrent sensors and display it on a 16x2 Character LCD and ive been trying for a while and nothing works so i was wondering if someone could do it for me or just giving a way to start off and some advice saying im not good at coding. im trying to have it swap between humidity and tempeture sensor(i have the one with 3 pins and its blue), the MPU-9250 gyro, MH MQ sensor, and the HW-502 heartbeat sensor, i have AT mega, thank you in advance

Nobody on here is going to do it for you, at least not for free. Why would anyone spend their time that way?

1 Like

what i did is just smashing a bunch of codes online together

1% of it worked

i might just use AI

Hi, @cj235
Sorry but had to spread your post out.

Your code would help.

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Have you written code for each of the sensors to prove you can communicate and get viable data from them?
If not, then start there.

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

Can You post that mix here? Please use code tags according to How to get the best out of this forum - Development Tools / IDE 1.x - Arduino Forum section CODE.

Why not start with the Arduino IDE Basic Examples? You could also use the Arduino.cc Education section OR look in the Arduino Project Hub for users like you who have contributed finished projects.

No, just no.

Please post any original complete sketches that you did not write, but found or borrowed or stole.

One for each sensor showing that you can wire it up and make it work, and the unit you have is functioning to specification.

Then we can talk about combining them.

If you have not found and successfully executed example code for any all of the things you mention, Do. That. First.

a7

1 Like

There are many MQ sensors. You must know which it is.

I will guess that you have never made a circuit. Why would you want to jump into this at an intermediate level without learning some basics of programming or electronics?

Imagine if you asked someone to make you a swimmer, and without a day of practice, you were taken an hour out to sea with the instructions to swim back to shore. I know this...

  1. You will not succeed.
  2. You will not like it.
  3. Many resources will be wasted.
  4. Fish will be fed.

Start with practicing code on a FREE Arduino simulator like WOKWI.COM. The simulation "sensors" each have an explanation and an example.

On wokwi, learn to write a helloworld.ino sketch.
Then, learn to read a pin.
Then, learn to write to a pin.
Then try your multi-device project.

Here is something small for after you have some practice to see what is ahead of you with function calls for your other devices...

byte buttonPin = 2; // declare a variable with a pin number, button is tied to Pin and Ground
byte ledPin = LED_BUILTIN; // declare an LED pin
byte state; // state of the LED

void setup() {
  Serial.begin(115200);
  pinMode(buttonPin, INPUT_PULLUP); // configure a pin for INPUT with a PULLUP resistor
  pinMode(ledPin, OUTPUT); // configure the LED pin as output
}

void loop() {
  if (digitalRead(buttonPin) == LOW) { // read button pin, LOW means PRESSED
    delay(150); // button debounce - wait for ringing to fade
    state = !state; // change LED state
    setLED(); // call the LED function
  }
}

void setLED() {
  digitalWrite(ledPin, state); // show the LED state
}
1 Like

Hi, @cj235

You might consider that the you may have to wait 24hours for a reply.
WHY?

  • Because the members that can help you are ALL OVER the world.
  • Offer their assistance FREE of charge.
  • Have to at least eat and sleep in that 24hours.

Can you please tell us your electronics, programming, arduino, hardware experience?

I suggest;

One of the biggest mistakes hobbyist programmers make is to try and implement too much at a time without spending adequate time testing each section. As a result, bugs start piling on top of other bugs, not only making them harder to find and isolate, but also making the number of bugs needing be squashed seem unmanageable.

A much better idea is to work incrementally. After each section of code has been written, think, “How am I going to test this?”, and then actually test it. If you find any bugs, either in the code you’ve just written, or in code that your code is relying on, those bugs should be taken care of immediately.

Tom... :grinning: :+1: :coffee: :australia:

How many of the Tutorial Examples included in the IDE have you learned from? Each has a link into the Arduino Main Site where additional explanation and elucidation are given.
How many sketches have you modified to test your knowledge and learn from? What have you made work?

There is no matrix download and simply reading will not teach you to write. You went through enough school to make posts so you know the steps to learn with include practice.

Are you able to read code line by line and know by looking things up when needed what each line should do? Until you can, you won't be much good at learning from Other People's Code (OPC).

When you don't understand, it's time to step back and learn.

There are a couple kinds of 16x2 Character LCDs that work completely differently.

An older one like this which requires many connections:

and a newer one like this which only requires a few connections:

(ignore that it is a 20x4)

Do you know which type you have?

Do you have pictures of your hardware?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.