Simulating sensor?

Hi guys, I want to know it is possible to simulate a sensor with array? for example reading the voltage sensor analog output values and save the output integers in a array.

thanks.

analogRead() returns a sensor value from 0 to 1023, so you can simulate this by plugging in an integer starting at 0 and incrementing to 1023 to test the entire range.

1 Like

thanks for your response. So it is possible ! I want to read the sine wave period with an analog sensor ( simulated ) and compare its value with a real sensor. Do you think it is possible?

As long as the sign wave is in the range between 0 VDC and analogReference(), set to 5 volts by default on the Arduino Uno, it's entirely doable.

1 Like

Thank you for taking the time to respond to me.

Yes, it sounds like you want to do several things at the same time one of them simulating a sensor, and others being the rest of your code.

Here's some code in Wokwi simulating some analog voltages: QuickChargeControl.ino - Wokwi Arduino and ESP32 Simulator

1 Like

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