Hirdetés
- Intel Core i3 / i5 / i7 / i9 10xxx "Comet Lake" és i3 / i5 / i7 / i9 11xxx "Rocket Lake" (LGA1200)
- Ne várj sokat a vásárlással: drágulás a láthatáron
- Milyen billentyűzetet vegyek?
- Azonnali informatikai kérdések órája
- Apple asztali gépek
- SSD kibeszélő
- Amazon Fire TV stick/box
- Samsung Galaxy Tab tablet topik
- Hogy is néznek ki a gépeink?
- Letisztultságra vágysz? Itt az ASUS legújabb miditornya
-
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
- Lexus, Toyota topik
- Robotporszívók
- Gumi és felni topik
- Intel Core i3 / i5 / i7 / i9 10xxx "Comet Lake" és i3 / i5 / i7 / i9 11xxx "Rocket Lake" (LGA1200)
- Gitáros topic
- Ne várj sokat a vásárlással: drágulás a láthatáron
- Milyen billentyűzetet vegyek?
- Filmgyűjtés
- Az eddigieknél részletesebb videón a Samsung harmonikamobilja
- Luck Dragon: Asszociációs játék. :)
- További aktív témák...
- Dell G3 gamer laptop i5-9300H 16GB DDR4 NVIDIA GTX1650 Windows 11 Excellent akkumulátor gamer laptop
- Razer Basilisk V3 Bolti ár:20k INGYEN FOXPOST
- ASUS ROG Spatha X Wireless Gaming Mouse (Csak kábel) Bolti ár:55k INGYEN FOXPOST
- OH Lenovo Yoga 9i x360 Érintős Hajtogatós Laptop Tab 14" -60% i7-1260P 16/512 Iris Xe 2,8K OLED 90Hz
- Glorious Gaming Model O Egerek Fehér/Fekete (Pici hiányosság) Bolti ár:30k INGYEN FOXPOST
- BESZÁMÍTÁS! MSI B450 R7 5800X 32GB DDR4 1TB SSD RTX 4070Ti 12GB Zalman S2 TG Enermax 750W
- GYÖNYÖRŰ iPhone 11 128GB Black -1 ÉV GARANCIA - Kártyafüggetlen, MS3271, 100% Akkumulátor
- Telefon szerviz helyben - Gyors javítás, akár 30 perc alatt!
- GYÖNYÖRŰ iPhone 13 mini 256GB Red -1 ÉV GARANCIA - Kártyafüggetlen, MS3405
- Sanyo akkutöltő + 2 használható akku
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: NetGo.hu Kft.
Város: Gödöllő
ekkold

