Circuits For Youtube channel
Sunday, 9 December 2018
Saturday, 4 November 2017
Thursday, 23 February 2017
Thursday, 11 August 2016
Monday, 1 August 2016
Thursday, 19 May 2016
Saturday, 26 March 2016
//IR Tachometer
long int value; long int t1; long int t2; int blank; void setup() { Serial.begin(9600); blank=analogRead(A0); // put your setup code here, to run once: } void out(long int a) { float freq; freq= (float)1000000/a; Serial.println(freq); delay(1500); } void loop() { value=analogRead(A0); if(value-blank>20)//When IR bounces back from bright surface; { t1=micros(); while(analogRead(A0)-blank>20);//Loop till the bright surface disappears while(analogRead(A0)-blank<20);//Loop till the bright surface reappears t2=micros(); out(t2-t1);//timeperiod is sent to function out to calculate rotations per second } //Serial.println(value); } // put your main code here, to run repeatedly:
Subscribe to:
Posts (Atom)





