Hirdetés
- Ha nem növelnéd feleslegesen a villanyszámlád, a Chieftecnek van pár új ajánlata
- ARC vs eARC — Ilyet is tud a HDMI-d? 🤨
- A következő évtizedbe repíti a NAND hatékonyságát a Samsung új kutatása
- ASUS blog: kisebb, de nem gyengébb – a mini PC-k forradalma
- 5 kilowattos GPU-k előtt nyitná meg az utat az Intel
- Pánik a memóriapiacon
- Intel Core i5 / i7 / i9 "Alder Lake-Raptor Lake/Refresh" (LGA1700)
- OLED TV topic
- Vezeték nélküli fülhallgatók
- Multimédiás / PC-s hangfalszettek (2.0, 2.1, 5.1)
- SSD kibeszélő
- Intel Core i7-5xxx "Haswell-E/EP" és i7-6xxx "Broadwell-E/EP" (LGA2011-v3)
- Milyen billentyűzetet vegyek?
- Bambu Lab 3D nyomtatók
- Milyen videókártyát?
-
PROHARDVER!
Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.
Új hozzászólás Aktív témák
-
Tomika86
senior tag
válasz
vargalex
#15675
üzenetére
const byte PulsesPerRevolution = 2;
const unsigned long ZeroTimeout = 100000; // For high response time, a good value would be 100000.
// For reading very low RPM, a good value would be 300000.
// Calibration for smoothing RPM:
const byte numReadings = 2; // Number of samples for smoothing. The higher, the more smoothing, but it's going to
// react slower to changes. 1 = no smoothing. Default: 2.
/////////////
// Variables:
/////////////
volatile unsigned long LastTimeWeMeasured; // Stores the last time we measured a pulse so we can calculate the period.
volatile unsigned long PeriodBetweenPulses = ZeroTimeout+1000; // Stores the period between pulses in microseconds.
// It has a big number so it doesn't start with 0 which would be interpreted as a high frequency.
volatile unsigned long PeriodAverage = ZeroTimeout+1000; // Stores the period between pulses in microseconds in total, if we are taking multiple pulses.
// It has a big number so it doesn't start with 0 which would be interpreted as a high frequency.
unsigned long FrequencyRaw; // Calculated frequency, based on the period. This has a lot of extra decimals without the decimal point.
unsigned long FrequencyReal; // Frequency without decimals.
unsigned long RPM; // Raw RPM without any processing.
unsigned int PulseCounter = 1; // Counts the amount of pulse readings we took so we can average multiple pulses before calculating the period.
unsigned long PeriodSum; // Stores the summation of all the periods to do the average.
unsigned long LastTimeCycleMeasure = LastTimeWeMeasured;
unsigned long CurrentMicros = micros();
unsigned int AmountOfReadings = 1;
unsigned int ZeroDebouncingExtra; // Stores the extra value added to the ZeroTimeout to debounce it.
// The ZeroTimeout needs debouncing so when the value is close to the threshold it
// doesn't jump from 0 to the value. This extra value changes the threshold a little
// when we show a 0.
// Variables for smoothing tachometer:
unsigned long readings[numReadings]; // The input.
unsigned long readIndex; // The index of the current reading.
unsigned long total; // The running total.
unsigned long average; // The RPM value after applying the smoothing.Annyit szeretnék, hogy ami itt 3db const van, azokat az értékeket, kijelzőn keresztül szeretném módosítani. De nem működik.
Persze a const elhagyva, és itt van a Zerotimeoutnál a +1000
Új hozzászólás Aktív témák
- Pánik a memóriapiacon
- Intel Core i5 / i7 / i9 "Alder Lake-Raptor Lake/Refresh" (LGA1700)
- Futárcégek
- Formula-1
- Fájhat Elon feje: mindjárt kész a Starlink-rivális
- Luck Dragon: Asszociációs játék. :)
- OLED TV topic
- Kaspersky Antivirus és Internet Security Fórum
- Vezeték nélküli fülhallgatók
- Multimédiás / PC-s hangfalszettek (2.0, 2.1, 5.1)
- További aktív témák...
- Dell Precision 7730,17.3",FHD,i5-8400H CPU,16GB DDR4,512GB SSD,WIN11
- ÚJ! BONTATLAN! Samsung 860 EVO 1TB SSD,2.5
- Új Prémium vezeték nélküli billentyűzet eladó Magyar (PBT) kupakokkal
- HP EliteBook X360 1030 G2,Multi-Touch 2 az 1-ben,i5-7300U,8GB DDR4,256GB SSD,WIN11
- ÚJ! BONTATLAN! WD BLUE Sata SSD 1TB,2.5,560/530
- HIBÁTLAN iPhone 13 Pro Max 128GB Alphine Green -1 ÉV GARANCIA - Kártyafüggetlen, MS3722, 100% Akksi
- LG 45GS95QX - 45" Ívelt OLED / 2K WQHD / 240Hz 0.03ms / NVIDIA G-Sync / FreeSync Premium / HDMI 2.1
- Xbox Game Pass Ultimate előfizetések kedvező áron
- Lenovo X13 Thinkpad Gen2 WUXGA IPS i5-1145G7 16GB RAM 256GB SSD Intel Iris XE Win11 Pro Garancia
- Tablet felvásárlás!! Apple iPad, iPad Mini, iPad Air, iPad Pro
Állásajánlatok
Cég: BroadBit Hungary Kft.
Város: Budakeszi
Cég: Laptopműhely Bt.
Város: Budapest
ekkold

