Where the YFS201 truly shines is in full-system simulations. For example:
C:\ProgramData\Labcenter Electronics\Proteus 8 Professional\Data\LIBRARY
Understanding these specifications will help you correctly integrate the sensor into your Proteus simulations: yfs201 proteus library
If you're searching on GitHub specifically, use the site filter: site:github.com YFS201 Proteus
const int flowSensorPin = 2; // Interrupt pin volatile int pulseCount = 0; float flowRate = 0.0; float totalVolume = 0.0; unsigned long previousMillis = 0; const long interval = 1000; // 1 second sampling interval Where the YFS201 truly shines is in full-system simulations
Example advanced simulation scenario:
To help you get the most out of your simulation, please let me know: float flowRate = 0.0
void loop() // Every second, calculate flow if((millis() - oldTime) > 1000) detachInterrupt(digitalPinToInterrupt(2));
// Standard YFS201 Interfacing Code volatile int pulseCount; // Measuring the pulses float flowRate; // Calculated flow rate unsigned int flowMilliLitres; unsigned long totalMilliLitres; unsigned long oldTime;
Connect the generator terminal directly to Arduino Digital Pin 2.