Yfs201 Proteus Library Exclusive [hot] Access

// Simple Arduino Code for YFS201 const int sensorPin = 2; volatile long pulseCount = 0; float flowRate = 0.0; unsigned int flowMilliLitres = 0; unsigned long totalMilliLitres = 0; unsigned long oldTime = 0; void pulseCounter() pulseCount++; void setup() Serial.begin(9600); pinMode(sensorPin, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING); void loop() if ((millis() - oldTime) > 1000) detachInterrupt(digitalPinToInterrupt(sensorPin)); // Calculation flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / 7.5; oldTime = millis(); pulseCount = 0; Serial.print("Flow Rate: "); Serial.print(flowRate); Serial.println(" L/min"); attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING); Use code with caution. Conclusion

Once you have downloaded the library files, the installation process is straightforward: yfs201 proteus library exclusive

volatile int pulseCount; float flowRate; unsigned int flowMilliLitres; unsigned long totalMilliLitres; unsigned long oldTime; void pulseCounter() pulseCount++; void setup() pinMode(2, INPUT_PULLUP); pulseCount = 0; flowRate = 0.0; totalMilliLitres = 0; oldTime = 0; attachInterrupt(0, pulseCounter, FALLING); // Pulse on pin 2 void loop() if((millis() - oldTime) > 1000) // Calculate flow rate flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / 7.5; oldTime = millis(); pulseCount = 0; // Output to simulation console Serial.print("Flow Rate: "); Serial.print(flowRate); Serial.println(" L/min"); Use code with caution. Conclusion: Elevate Your IoT Projects // Simple Arduino Code for YFS201 const int

Open ISIS Schematic Capture in Proteus and pick the following components from the library manager ( P shortcut): (Requires an Arduino Proteus library) YF-S201 Flow Sensor (From your newly installed library) LM016L (Standard 16x2 LCD) Virtual Terminal (To monitor serial debug messages) 2. Wiring Diagram Connections Wiring Diagram Connections Once installed, you can find

Once installed, you can find the sensor by clicking the icon and searching for "YF-S201". VCC : Connect to a +5V DC source. GND : Connect to the common circuit ground.