Bonjour
j'ai trouvé un programme Arduino qui me permet de calculer la frequence sans utiliser un frequence metre
Le cablage dans l'Isis est tout simplement relier le signal entrant avec les ports analogiques mais j'ai pas compris la programmation
Merci
Code:+#include <LiquidCrystal.h> + +LiquidCrystal lcd(8, 9, 4, 5, 6, 7); + +long microSecs; +long freq; +int lastBit; +int nowVal; +long secs; +long maxHz; +long minHz; +long minmax; +void setup() { + // set up the LCD's number of columns and rows: + lcd.begin(16, 2); + // Print a message to the LCD. + lcd.print("Loading..."); + pinMode(A1,INPUT); + pinMode(A5,OUTPUT); + microSecs = micros(); + freq = 0; + lastBit = 0; + nowVal =0; + maxHz=0; + minHz=0; + minmax=0; + secs = millis(); + //Serial.begin(9600); +} +int x=0; +void loop() { + + + if ((microSecs+20)<micros()){ + nowVal=digitalRead(A1); + + if (lastBit!=nowVal) { + lastBit=nowVal; + freq=freq+1; + } + if (freq>maxHz){ + maxHz=freq; + } + if (freq<minHz){ + minHz=freq; + } + //lcd.clear(); + //lcd.print(); + microSecs = micros(); + } + if (secs+1000<millis()){ + + if (minmax+300000<millis()) + { + minmax=millis(); + minHz=freq; + maxHz=freq; + + } + + lcd.clear(); + lcd.print((freq/2)); + lcd.print("hz"); + lcd.setCursor(0,1); + lcd.print("+: "); + lcd.print(maxHz); + lcd.print(" -: "); + lcd.print(minHz); + + freq=0; + secs=millis(); + + } + +}
-----