Skip to content

Instantly share code, notes, and snippets.

View MLpranav's full-sized avatar
🎯
Focusing

Pranav MLpranav

🎯
Focusing
View GitHub Profile
@MLpranav
MLpranav / astronomia4.ino
Created June 16, 2020 11:05
Astronomia 4
void loop() {
if (digitalRead(button)==LOW){ //if button is pressed
for (int thisNote = 0; thisNote < looptune; thisNote++) {
int noteDuration = 750/4;
tone(buzzer, melody[thisNote%72], noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(buzzer);
}
}
@MLpranav
MLpranav / astronomia3.ino
Created June 16, 2020 11:05
Astronomia 3
void setup() {
pinMode(button, INPUT_PULLUP);
looptune = looptune * 72; //do not change this
}
@MLpranav
MLpranav / astronomia2.ino
Created June 16, 2020 11:04
Astronomia 2
int melody[] = {
NOTE_G5, NOTE_G5, NOTE_G5, NOTE_G5,
NOTE_C5, NOTE_AS4, NOTE_A4, NOTE_F4,
NOTE_G4, 0, NOTE_G4, NOTE_D5,
NOTE_C5, 0, NOTE_AS4, 0,
NOTE_A4, 0, NOTE_A4, NOTE_A4,
NOTE_C5, 0, NOTE_AS4, NOTE_A4,
NOTE_G4,0, NOTE_G4, NOTE_AS5,
NOTE_A5, NOTE_AS5, NOTE_A5, NOTE_AS5,
NOTE_G4,0, NOTE_G4, NOTE_AS5,
@MLpranav
MLpranav / astronomia1.ino
Created June 16, 2020 11:02
Astronomia 1
#include "pitches.h"
int button = 5; //pin to connect to button
int buzzer = 8; //pin to connect to buzzer +ve terminal
int looptune = 2; // how many times do you want the tune to loop
@MLpranav
MLpranav / esp01.ino
Created June 16, 2020 10:57
ESP-01 Bonus GPIOs
//To use TX as GPIO:
pinMode(1, FUNCTION_3);
//To use RX as GPIO:
pinMode(3, FUNCTION_3);