Advanced Search
Search Results
167 total results found
Using a Membrane Potentiometer (SoftPot)
...he built-in LED when touched lightly. int SOFT_POT_PIN = A0; void setup() { Serial.begin(9600); pinMode(SOFT_POT_PIN, INPUT); } void loop() { int softPotPosition = analogRead(SOFT_POT_PIN); Serial.println(softPotPosition); delay(100); }
Using a HC-SR04 distance sensor
...if the ping sound is reflected away from the sensor by an a diverg ...distanceSensor(13, 12); void setup () { Serial.begin(9600); //initialize serial connection so that we could print values from sensor. pinMode(13, OUTPUT); } void loop () { ...
How to use a Flat Vibration Switch
...ED on most Arduino boards void setup() { Serial.begin(9600); } void loop() { int state = digitalRead(vibrationPin); if (state == HIGH) { digitalWrite(ledPin, HIGH); Serial.println("Vibration detected!"); } else { digitalWrite(ledPin...
How to use a Reed Switch
... // LED pin - active-high void setup() { Serial.begin(9600); // Since the other end of the reed switch is connected to ground, we need // to pull-up the reed switch pin internally. pinMode(REED_PIN, INPUT_PULLUP); pinMode(LED_PIN, OUTPUT); } v...
How to use a EMG Muscle Sensor
...ZE]; int data_index, sum; void setup() { // Serial connection begin Serial.begin(115200); pinMode(13, OUTPUT); } void loop() { static unsigned long past = 0; unsigned long present = micros(); unsigned long interval = present - past; past ...