I am new to using Arduino and have a question on how I should go about coding my air pollution device. It consists of 5 different sensors, each measuring the concentration of different pollutants. A tone will sound and a light will turn on to indicate the safety of the pollutant levels. There will be 6 warning levels. For example, if one or more sensors has a pollutant concentration reading that is within a defined "dangerous" range, the light corresponding to that range turn on and a tone will sound. I am using an Arduino Nano.
My questions are:
The codes for the 5 sensors are all in 5 different sketches. Will they need to be combined into one?
How should I go about writing a code to trigger the light/sound corresponding to different warning levels?
Your question inspires me to tip You of working through a number of simple example sketches. There is such example code within the IDE. That will make You a lot more comfortable in this environment.
Yes, you will have to combine them, if you want them all to work on one Arduino at the same time. This usually means coming to a minimum understanding of each constituent sketch. I t can mean completely undertanding how a sketch works, and rewriting it having in mind that you'll be up to other things.
google
arduino combine two sketches
and poke around - the principles for combing five sketches is the same.
goolge
arduino two things at once
and
arduino blink without delay
for ideas.
Two.
That's up to you! What do you want the lights to do? What kind of sounds, and what kind of hardware to make them, do you have planned for your project?
I like klaxon horns and strobe lights myself. Get someone's attention!