Circuit Documentation
Summary
This circuit consists of an Arduino 101 microcontroller, a green LED, and a 2-pin push switch. The circuit is designed to control the LED using the push button. When the button is pressed, the LED turns on, and when the button is released, the LED turns off.
Component List
Arduino 101
- Description: A microcontroller board based on the Intel Curie module.
- Pins: A5/SCL, A4/SDA, AREF, GND, D13/SCK, D12/MISO, D11 PWM/MOSI, D10 PWM/SS, D9 PWM, D8, D7, D6 PWM, D5 PWM, D4, D3 PWM, D2, D1/TX, D0/RX, AIN, ioref, RESET, 3V3, 5V, VIN, A0, A1, A2, A3, ICSP MISO, ICSP SCK, ICSP MOSI
LED: Two Pin (green)
- Description: A green LED with two pins, anode and cathode.
- Pins: cathode, anode
2Pin Push Switch
- Description: A simple push button switch with two pins.
- Pins: Input +, Output +
Wiring Details
Arduino 101
GND is connected to:
- Input + of the 2Pin Push Switch
- cathode of the LED: Two Pin (green)
D7 is connected to:
- Output + of the 2Pin Push Switch
D2 is connected to:
- anode of the LED: Two Pin (green)
LED: Two Pin (green)
cathode is connected to:
- GND of the Arduino 101
anode is connected to:
- D2 of the Arduino 101
2Pin Push Switch
Input + is connected to:
- GND of the Arduino 101
Output + is connected to:
- D7 of the Arduino 101
Code
Arduino 101 Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
2Pin Push Switch Code
/*
* This Arduino sketch controls an LED using a push button.
* When the button is pressed, the LED turns on. When the button is released,
* the LED turns off.
*/
const int buttonPin = 7; // Pin connected to the push button
const int ledPin = 2; // Pin connected to the LED
void setup() {
// Initialize the button pin as an input
pinMode(buttonPin, INPUT);
// Initialize the LED pin as an output
pinMode(ledPin, OUTPUT);
}
void loop() {
// Read the state of the push button
int buttonState = digitalRead(buttonPin);
// If the button is pressed, turn on the LED
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
} else {
// Otherwise, turn off the LED
digitalWrite(ledPin, LOW);
}
}
This documentation provides a comprehensive overview of the circuit, including a summary, detailed component list, wiring details, and the code used for the microcontroller.
