PMGOHARIAN
Published © GPL3+

How to Make an Ultrasonic Levitator Using Arduino

Today I will show you how to make your ultrasonic levitator using an Arduino Nano.

IntermediateFull instructions provided4,676
How to Make an Ultrasonic Levitator Using Arduino

Things used in this project

Story

Read more

Code

.__40khz.ino

C/C++
byte TP = 0b10101010; //jeder 2. Port bekommt das umgekehrte Signal

void setup()
{
 DDRC = 0b11111111; //Alle Analogports als Ausgang definieren
 
  // Timer 1 initialisieren
  noInterrupts();           // Interrupts deaktivieren
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1  = 0;

  OCR1A = 200;              // Compare Match Register setzen (16MHz / 200 = 80kHz Rechteck -> 40kHz Vollwelle )
  TCCR1B |= (1 << WGM12);   // CTC mode
  TCCR1B |= (1 << CS10);    // Prescaler auf 1 ==> kein prescalling
  TIMSK1 |= (1 << OCIE1A);  // Compare Timer Interrupt einschalten
  interrupts();             // Interrupts aktivieren
}

ISR(TIMER1_COMPA_vect)          
{
  PORTC = TP; // Den Wert TP an die Ausgange senden
  TP = ~TP;   // TP invertieren fr den nchsten durchlauf
}

void loop(){
  // hier bleibt  nichts zu tun brig:-(
}

Credits

PMGOHARIAN

PMGOHARIAN

0 projects • 8 followers
what's up everyone its PM.GOHARIAN . I make electronic content , if want see more just subscribe me on youtube and IG . peace !

Comments