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.
DescripciónCpp
const int ledPins[] = {2, 3, 4, 5}; int contador = 0; bool enMarcha = false; int brillo = 255; // Valor inicial a máximo brillo void setup() { Serial.begin(9600); for (int i = 0; i < 4; i++) { pinMode(ledPins[i], OUTPUT); } } void loop() { if (Serial.available()) { char comando = Serial.read(); if (comando == 'p') { enMarcha = !enMarcha; Serial.println(enMarcha ? "Play" : "Pause"); } } if (enMarcha) { mostrarBinario(contador); Serial.print("Contador: "); Serial.println(contador); contador++; if (contador > 15) contador = 0; delay(1000); } ajustarBrillo(); } void mostrarBinario(int num) { for (int i = 0; i < 4; i++) { int estado = (num >> i) & 1; analogWrite(ledPins[i], estado * brillo); } } void ajustarBrillo() { int valorPot = analogRead(A0); brillo = map(valorPot, 0, 1023, 0, 255); }
Reviews
Inspect
Arduino Uno R3 Shield Template
Controls
Properties
Availability & Pricing
| Distributor | Qty 1 | |
|---|---|---|
| Digi-Key | $1.02 | |
Assets
id=Arduino UNO 3D
id=Arduino UNO R3 shield - Shape
id=Arduino Uno R3 Shield Template-removebg-preview
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.