Chat
Welcome to Flux
Treat Flux like your intern. Tell it what you'd like to build and it'll get to work. You can also ask it questions, brainstorm ideas, and teach it your preferences. Learn More
Ready.
C
// Pin Definitions const int buttonOnPin = 2; // Button to turn LED on const int buttonOffPin = 3; // Button to turn LED off const int ledPin = 13; // LED pin void setup() { // Initialize the button pins as input with internal pull-up pinMode(buttonOnPin, INPUT_PULLUP); pinMode(buttonOffPin, INPUT_PULLUP); // Initialize the LED pin as an output pinMode(ledPin, OUTPUT); // Ensure LED is off initially digitalWrite(ledPin, LOW); } void loop() { // Read the state of the buttons int buttonOnState = digitalRead(buttonOnPin); int buttonOffState = digitalRead(buttonOffPin); // If the 'On' button is pressed (pin reads LOW because of pull-up resistor) if (buttonOnState == LOW) { digitalWrite(ledPin, HIGH); // Turn the LED on } // If the 'Off' button is pressed if (buttonOffState == LOW) { digitalWrite(ledPin, LOW); // Turn the LED off } }
INPUT_PULLUP. This means the pins will read HIGH when the button is not pressed and LOW when it is pressed.loop function.ledPin HIGH.ledPin LOW.Reviews
Properties
Properties describe core aspects of the project.
Pricing & Availability
Distributor | Qty 1 |
|---|---|
Digi-Key | $12.14–$15.40 |
LCSC | $13.04 |
Mouser | $14.08 |
Assets
No assets added.
Controls
Welcome 👋
Flux helps you build PCBs faster with an AI teammate!
Create your account to collaborate, stay updated, fork your own version, and get instant answers from our AI agent.
chimuelo20
copilot
- U1 (PIC16F877A-I/P): This is a popular 8-bit microcontroller from Microchip Technology. It features multiple digital I/O pins, analog inputs, timers, PWM capability, and serial communication interfaces like USART among other functions. It serves as the brain of this project, controlling other components based on the programmed logic.
Power Supply:- BATT1 and BATT2 (1070TR): These are batteries with a voltage rating of 4V. The use of two batteries might imply a need for redundancy, increasing battery life, or requiring a specific voltage configuration.
Input Devices:- SW1 and SW2 (B3FS-1050P): These are tactile switches from Omron. They likely serve as inputs to the microcontroller for triggering specific actions or changing modes in the circuit.
Resistors:- R1 ($10k\Omega$), R2 ($220\Omega$), R3 ($1k\Omega$): These resistors might serve various purposes such as pull-ups/downs, current limiting for LEDs, or part of an analog circuit. The specific use would depend on their connections in the schematic.
LED:- LED1 (WP7113SRD/D): A standard red LED with a forward voltage of 1.85V. It's typically used as an indicator light, showing the status of part of the circuit or the output of some operation.
Oscillator:- X1: An external oscillator with a frequency of 10MHz. It provides a stable clock source for the microcontroller, ensuring accurate timing for its operations.
Nets and Connections:- The oscillator (
- The microcontroller is interfaced with an LED (
- Two switches (
- Batteries (
General Purpose:X1) is connected between theOSC1/CLKIandOSC2/CLKOpins of the microcontroller, providing it with a clock signal.LED1) through a resistor (R2), which likely serves to limit the current through the LED.SW1andSW2) are used, withSW1also being part of the circuit that includes an LED andR3, implying it might be used to control the LED.BATT1andBATT2) are represented with their positive and negative terminals connected to various components, showing how power is distributed within the circuit.