Advanced Search
Search Results
147 total results found
Making Breathing Light with LEDs
...ED is int fadeAmount = 5; void setup() { pinMode(led, OUTPUT); pinMode(led2, OUTPUT); //optional for 2nd led } void loop() { //breathing light analogWrite(led, brightness); analogWrite(led2, brightness); //optional for 2nd led brightness =...
How to use a PIR sensor
... // PIR status void setup() { pinMode(ledPin, OUTPUT); pinMode(pirPin, INPUT); Serial.begin(9600); } void loop(){ pirStat = digitalRead(pirPin); if (pirStat == HIGH) { // if motion detected digital...
How to Program an ATtiny85 with an Arduino Uno
...STYLE_WIRING to the code before setup() UPLOAD! Wiring The pins are not labelled so you will have to refer to the pinout. Arduino --> ATtiny85 5V --> Vcc (8) GND --> GND (4) Pin 13 --> Pin 2 (7) Pin 12 --> Pin 1 (6) Pin 11 ...
How to use a Hall Effect Sensor
...e the state of the sensor void setup() { Serial.begin(9600); // Start serial communication at 9600 baud pinMode(hallSensorPin, INPUT); // Set the Hall Effect sensor pin as an INPUT } void loop() { hallSensorState = digitalRead(ha...
How to Configure a Raspberry Pi for the first time
...n change that after the initial setup. Check this tutorial for chang ...start menu. 6. Recommended Software Raspberry Pi comes with many ... can start using them straight away, such as Thonny. You can go to ... - Preference - Recommended Software, explore the list and downloa...
How to use a Bare Conductive Touch Board with Arduino
...ng the above two tutorials. Hardware Plugin Whenever we use an Ard ...e it opened. Download the Hardware Plugin here: bare-conductive- ...duino-public.zip Create a hardware folder Windows: Libraries/Do ...cuments/Arduino/hardware OR My Documents/Arduino/hardw...
How to build a Simple Robot Arm with Servo Motor and Joystick
...D Workshop to laser cut the hardware. In this tutorial, we will fo ...rvo; Servo angleServo; void setup() { Serial.begin(9600) ; rotateServo.attach(servoRotation); angleServo.attach(servoAngle); } void loop() { // read analog potentiometer val...
Controlling an actuator with a N-channel Mosfet
...ital device. #define actuatorPin 13 void setup() { pinMode( actuatorPin, OUTPUT ); } void loop() { digitalWrite( actuatorPin, HIGH ); delay( 1000 ); digitalWrite( actuatorPin, LOW ); delay( 1000 ); }
Using a Force Sensor
... touch int limit = 200; void setup() { Serial.begin(9600); pinMode(13, OUTPUT); } void loop() { sensorValue = analogRead(sensorPin); Serial.print("Force Level: "); Serial.println(sensorValue); if (sensorValue > limit) { digitalWrite(13, HIGH...
Using L293D IC for motors
...and has custom functions for forward(), backward(), stop(), turnRight() and ...is will run only one time. void setup(){ //Set pins as outputs ...; */ } void loop(){ forward(); delay(5000); backward(); delay(5000); stop()...
Using a Soil Moisture Sensor
...nge of moisture generally void setup() { Serial.begin(9600); pinMode(13, OUTPUT); } void loop() { sensorValue = analogRead(sensorPin); Serial.print("Moisture Level: "); Serial.println(sensorValue); if (sensorValue < limit) { digitalWrite(13, H...
Using Arduino Leonardo to send USB MIDI data
...sor. #include "MIDIUSB.h" void setup() { Serial.begin(115200); } void loop() { Serial.println("Sending note on"); noteOn(0, 48, 64); // Channel 0, middle C, normal velocity MidiUSB.flush(); delay(500); Serial.println("Sending note off"); ...
Using an MFRC522 RFID reader
...h each identification and a two-way radio transmitter-receiver as .../ Create MFRC522 instance void setup() { Serial.begin(9600); // Initialize serial communications with the PC while (!Serial); // Do nothing if no serial port is opened (added for Ar...
How to fix "Internal data stream error" in Processing 4
...ng.video.*; Capture cam; void setup() { size(640, 480); String[] cameras = Capture.list(); if (cameras.length == 0) { println("There are no cameras available for capture."); exit(); } else { println("Available cameras:"); for ...
How to connect a Light Dependent Resistor (LDR)
... A0 int value; int limit; void setup() { Serial.begin( 9600 ); pinMode( ldrPin, INPUT ); pinMode(LED_BUILTIN, OUTPUT); } void loop() { value = analogRead( ldrPin ); Serial.println( value ); if(value < limit){ digitalWrite(LED_BUILTIN, ...
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...