Skip to content

Instantly share code, notes, and snippets.

int micPin = A0; // pin that the mic is attached to
int gndPin = A1;
int powerPin = A2;
int micValue1 = 0;
int micValue2 = 0; // the Microphone value
int led1 = 13;
boolean lightOn = false;
void setup() {
#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
#define NOTE_F1 44
#define NOTE_FS1 46
#define NOTE_G1 49
#define NOTE_GS1 52
const int trigPin = 9;
const int echoPin = 10;
long duration;
int distanceCm, distanceInch;
void setup()
{
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(11,OUTPUT);
#include <Servo.h>
int val = 0 ;
Servo s1;
void setup()
{
Serial.begin(9600);
pinMode(2,INPUT);
s1.attach(11);
}
void loop()
//http://www.youtube.com/diyelectronic is Fun//
//http://www.instagram.com/diyelectronic is Fun//
//Project by Diy Electronic//
int pinsCount=10; // declaring the integer variable pinsCount
int pins[] = {2,3,4,5,6,7,8,9,10,11}; // declaring the array pins[]
void setup() {
for (int i=0; i<pinsCount; i=i+1){ // counting the variable i from 0 to 9
#include <Servo.h>
#define threshold 250
#define unpress_angle 70
#define press_angle 36
Servo myservo; // create servo object to control a servo
bool trig=true;
void setup() {