Tuesday, June 28, 2022

tinkercad low pass filter


int d = 1000;
int count = 0;
float count_max = 3;
  
void setup()
{
  DDRD = 0b10000000; //pin 7 as output
  Serial.begin(9600);
}

void loop()
{
  PORTD ^= 0b10000000; //toggle pin 7
  Serial.println(d);
  delay(d);
  
  count++;
  if(count>count_max){
  d = d*0.9;
    count = 0;
    count_max = count_max * 1.11;
    Serial.println(count_max);
  }
  
  if(d<1){d=1000;}
}

reference:

No comments:

Post a Comment