This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const int switchPin = 2; | |
| const int motorPin = 9; | |
| int switchState = 0; | |
| void setup() { | |
| // declare pins' directions | |
| pinMode(switchPin, INPUT); | |
| pinMode(motorPin, OUTPUT); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <CapacitiveSensor.h> | |
| CapacitiveSensor capSensor = CapacitiveSensor(4, 2); | |
| // set up lamp capacitance threshold | |
| int threshold = 400000; | |
| const int ledPin = 12; | |
| void setup() { | |
| Serial.begin(9600); | |
| pinMode(ledPin, OUTPUT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Servo.h> | |
| Servo myServo; | |
| // constant variables for input and output components | |
| const int piezo = A0; | |
| const int switchPin = 2; | |
| const int redLED = 3; | |
| const int yellowLED = 4; | |
| const int greenLED = 5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // set up LiquidCrystal library | |
| #include <LiquidCrystal.h> | |
| LiquidCrystal lcd(12, 11, 5, 4, 3, 2); | |
| const int switchPin = 6; | |
| int switchState = 0; | |
| int prevSwitchState = 0; | |
| int response; | |
| void setup() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const int switchPin = 8; | |
| unsigned long int prevTime = 0; | |
| long interval = 300000; | |
| int switchState = 0; | |
| int prevSwitchState = 0; | |
| int nextLED = 2; | |
| void setup() { | |
| // set direction of digital pins | |
| for( int x = 2; x < 8; x++ ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // set up array of 6 integers representing frequencies | |
| int notes[] = [ 262, 294, 330, 349]; | |
| void setup() { | |
| // begin serial communnication | |
| Serial.begin(9600); | |
| } | |
| void loop() { | |
| // read analog value and send to serial monitor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // create variables for calibrating the sensor | |
| int sensorValue; | |
| int sensorLow = 1023; | |
| int sensorHigh = 0; | |
| // create constant for calibration indicator at on-board LED connected to pin 13 | |
| const int ledPin = 13; | |
| void setup() { | |
| // set digital pin direction and turn it high |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // import Servo library | |
| #include <Servo.h> | |
| // create Servo object from library | |
| Servo myServo; | |
| // declare variables for potentiometer pin, analog input value and servo angle | |
| int const potPin = A0; | |
| int potVal; | |
| int angle; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // set up constants for input and output pins | |
| const int redLEDPin = 9; | |
| const int greenLEDPin = 10; | |
| const int blueLEDPin = 11; | |
| const int redSensorPin = A0; | |
| const int greenSensorPin = A1; | |
| const int blueSensorPin = A2; | |
| // add variables for incoming sensor and output values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // declare global constant variables | |
| const int sensorPin = A0; | |
| const float baselineTemp = 20.0; | |
| void setup() { | |
| // open a serial port connection between the Arduino board and computer | |
| // allowing communication at 9600 bauds (bits per second) | |
| Serial.begin(9600); | |
| // assign digital pins as output and toggle off |
NewerOlder