งานที่7


                        
#include "LedControl.h"
#define C4  262
#define D4  294
#define E4  330
#define F4  349
#define G4  392
#define A4  440
#define B4  494
#define C5  523
int melody[] = {C4,D4,E4,F4,G4,A4,B4,C5};
float beats[] ={1,1,1,1,1,1,1,1};
int buzzerpin = 11;
int timestop = 70;
LedControl lc=LedControl(8,10,9,1);
void setup()
{
  lc.shutdown(0,false); 
  lc.setIntensity(0,5);
  lc.clearDisplay(0);
  int dl = 500;
  pinMode(buzzerpin,OUTPUT);
  int numnote;
  numnote = sizeof(melody)/2; 
  for (int i=0;i<numnote;i++)
  {
    lc.setChar(0,7-i,'-',false);
    tone(buzzerpin, melody[i],dl*beats[i]);
    delay(dl*beats[i]);
    digitalWrite(buzzerpin,HIGH);
    delay(timestop);
  }
}
void loop()
{
}

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

https://www.arduitronics.com/article/22/arduino-and-motor-control-part-1

https://www.9arduino.com/article/71/โปรเจคเครื่องรดน้ำต้นไม้อัตโนมัติ-ด้วย-arduino-ราคาถูก-พร้อม-code-ตัวอย่าง

https://medium.com/sathittham/arduino-lcd-16x2-hello-world-dca09fd904f8