Arduino Temperature Sensor with buttons
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to code buttons to display temp sensor on my arduino board. So, in our project we have two temp sensor and two buttons we have to figure out that when we press one button it would display temperature from one sensor and when we press button 2 it should display temperature from temp sensor 2.
0 Kommentare
Antworten (2)
Jogesh Nanda
am 27 Feb. 2019
The solution is simple. In the Arduino declare a variable to pass temperature
double temperature;
Then write a if else condition for switch
if (button 1 == pressed)
temperature = temp 1;
else if (button 2 == pressed)
temperature = temp 2;
end
then send the temperature value to Serial.print.
0 Kommentare
Madhu Govindarajan
am 27 Feb. 2019
If you need your code to be deployed to the Arduino and work independent of PC, then use Simulink Support Package for Arduino. It has different blocks that can help bring in the temperature sensor data (Analog read, I2C Read, SPI) depending on the output type of sensor. Likewise there is a block that reads digital pins to detect button press. You might have to use/create a display block for the specific display module.
If you are looking for code to run on MATLAB while Arduino is connected to PC, then use MATLAB Support Package for Arduino. Use the Getting Started resources on the website to help understand how to bring in sensor data and write sensor data to displays.
Usually I have seen that experts are more willing to help when you have made some progress and ask their help for when you are stuck, as opposed to asking a completely open ended problem.
HTH,
Madhu
0 Kommentare
Siehe auch
Kategorien
Mehr zu Modeling finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!